本文整理汇总了C++中ProjectPtr::GetFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectPtr::GetFileName方法的具体用法?C++ ProjectPtr::GetFileName怎么用?C++ ProjectPtr::GetFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectPtr
的用法示例。
在下文中一共展示了ProjectPtr::GetFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoSetWorkingDirectory
void ShellCommand::DoSetWorkingDirectory(ProjectPtr proj, bool isCustom, bool isFileOnly)
{
//when using custom build, user can select different working directory
if (proj) {
if (isCustom) {
//first set the path to the project working directory
::wxSetWorkingDirectory(proj->GetFileName().GetPath());
BuildConfigPtr buildConf = WorkspaceST::Get()->GetProjBuildConf(m_info.GetProject(), m_info.GetConfiguration());
if (buildConf) {
wxString wd = buildConf->GetCustomBuildWorkingDir();
if (wd.IsEmpty()) {
// use the project path
wd = proj->GetFileName().GetPath();
} else {
// expand macros from path
wd = ExpandAllVariables(wd, WorkspaceST::Get(), proj->GetName(), buildConf->GetName(), wxEmptyString);
}
::wxSetWorkingDirectory(wd);
}
} else {
if(m_info.GetProjectOnly() || isFileOnly) {
//first set the path to the project working directory
::wxSetWorkingDirectory(proj->GetFileName().GetPath());
}
}
}
}
示例2: SetData
void ReconcileProjectFiletypesDlg::SetData()
{
ProjectPtr proj = ManagerST::Get()->GetProject(m_projname);
wxCHECK_RET(proj, "Can't find a Project with the supplied name");
wxString topleveldir, types;
wxArrayString ignorefiles, excludes, regexes;
proj->GetReconciliationData(topleveldir, types, ignorefiles, excludes, regexes);
if (topleveldir.empty()) {
topleveldir = proj->GetFileName().GetPath();
}
wxFileName tld(topleveldir);
if ( tld.IsRelative() ) {
tld.MakeAbsolute( proj->GetFileName().GetPath() );
}
m_dirPickerToplevel->SetPath(tld.GetFullPath());
if (types.empty()) {
types << "cpp;c;h;hpp;xrc;wxcp;fbp";
}
m_textExtensions->ChangeValue(types);
m_listIgnoreFiles->Clear();
m_listIgnoreFiles->Append(ignorefiles);
m_listExclude->Clear();
m_listExclude->Append(excludes);
m_listCtrlRegexes->DeleteAllItems();
for (size_t n = 0; n < regexes.GetCount(); ++n) {
SetRegex(regexes[n]);
}
}
示例3: OnIgnoreBrowse
void ReconcileProjectFiletypesDlg::OnIgnoreBrowse(wxCommandEvent& WXUNUSED(event))
{
ProjectPtr proj = ManagerST::Get()->GetProject(m_projname);
wxCHECK_RET(proj, "Can't find a Project with the supplied name");
wxString topleveldir, types;
wxArrayString ignorefiles, excludes, regexes;
proj->GetReconciliationData(topleveldir, types, ignorefiles, excludes, regexes);
if (topleveldir.empty()) {
topleveldir = proj->GetFileName().GetPath();
}
wxFileName tld(topleveldir);
if ( tld.IsRelative() ) {
tld.MakeAbsolute( proj->GetFileName().GetPath() );
}
wxString new_exclude = wxDirSelector(_("Select a directory to ignore:"), tld.GetFullPath(), wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
if (!new_exclude.empty()) {
wxFileName fn = wxFileName::DirName(new_exclude);
fn.MakeRelativeTo(topleveldir);
new_exclude = fn.GetFullPath();
if (m_listExclude->FindString(new_exclude) == wxNOT_FOUND) {
m_listExclude->Append(new_exclude);
}
}
}
示例4: CheckProject
void MemCheckPlugin::CheckProject(const wxString& projectName)
{
if(m_terminal.IsRunning()) {
::wxMessageBox(_("Another instance is already running. Please stop it before executing another one"),
"CodeLite",
wxICON_WARNING | wxCENTER | wxOK);
return;
}
wxString errMsg;
ProjectPtr project = m_mgr->GetWorkspace()->FindProjectByName(projectName, errMsg);
wxString path = project->GetFileName().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
wxString wd;
wxString command = m_mgr->GetProjectExecutionCommand(projectName, wd);
DirSaver ds;
EnvSetter envGuard(m_mgr->GetEnv());
wxSetWorkingDirectory(path);
wxSetWorkingDirectory(wd);
m_mgr->AppendOutputTabText(kOutputTab_Output, _("Launching MemCheck...\n"));
m_mgr->AppendOutputTabText(kOutputTab_Output,
wxString() << _("Working directory is set to: ") << ::wxGetCwd() << "\n");
m_mgr->AppendOutputTabText(kOutputTab_Output,
wxString() << "MemCheck command: " << m_memcheckProcessor->GetExecutionCommand(command)
<< "\n");
wxString cmd = m_memcheckProcessor->GetExecutionCommand(command);
m_terminal.ExecuteConsole(cmd, "", true, wxString::Format("MemCheck: %s", projectName));
}
示例5: OnDebugStart
void LLDBDebuggerPlugin::OnDebugStart(clDebugEvent& event)
{
event.Skip();
return;
if ( ::PromptForYesNoDialogWithCheckbox(_("Would you like to use LLDB debugger as your primary debugger?"), "UseLLDB") != wxID_YES ) {
event.Skip();
return;
}
// Get the executable to debug
wxString errMsg;
ProjectPtr pProject = WorkspaceST::Get()->FindProjectByName(event.GetProjectName(), errMsg);
if ( !pProject ) {
event.Skip();
return;
}
wxSetWorkingDirectory ( pProject->GetFileName().GetPath() );
BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf ( pProject->GetName(), wxEmptyString );
if ( !bldConf ) {
event.Skip();
return;
}
// Show the terminal
ShowTerminal("LLDB Console Window");
if ( m_debugger.Start("/home/eran/devl/TestArea/TestHang/Debug/TestHang") ) {
m_debugger.AddBreakpoint("main");
m_debugger.ApplyBreakpoints();
m_debugger.Run("/tmp/in", "/tmp/out", "/tmp/err", wxArrayString(), wxArrayString(), ::wxGetCwd());
}
}
示例6: OnClassWizard
//------------------------------------------------------------
void SnipWiz::OnClassWizard(wxCommandEvent& e)
{
TemplateClassDlg dlg(m_mgr->GetTheApp()->GetTopWindow(), this, m_mgr);
wxString errMsg, projectPath, projectName;
TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileView);
projectName = m_mgr->GetWorkspace()->GetActiveProjectName();
if(m_mgr->GetWorkspace()) {
if(item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory) {
projectPath = item.m_fileName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
} else {
ProjectPtr proj = m_mgr->GetWorkspace()->FindProjectByName(projectName, errMsg);
if(proj) projectPath = proj->GetFileName().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
}
}
dlg.SetCurEol(GetEOLByOS());
dlg.SetPluginPath(m_pluginPath);
dlg.SetProjectPath(projectPath);
dlg.ShowModal();
if(dlg.GetModified()) {
m_modified = true;
}
}
示例7: DoGetBuildCommand
wxString QMakePlugin::DoGetBuildCommand(const wxString &project, const wxString &config, bool projectOnly)
{
wxUnusedVar ( config );
wxString errMsg;
ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg);
if ( !p ) {
return wxEmptyString;
}
BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf(project, config);
wxString cmd;
if ( !projectOnly ) {
cmd << wxT("@cd \"") << p->GetFileName().GetPath() << wxT("\" && ");
}
// fix: replace all Windows like slashes to POSIX
wxString command = bldConf->GetCompiler()->GetTool("MAKE");
command.Replace(wxT("\\"), wxT("/"));
cmd << command << wxT(" \"") << p->GetName() << wxT(".mk\"");
return cmd;
}
示例8: DoGetBuildCommand
wxString QMakePlugin::DoGetBuildCommand(const wxString& project, const wxString& config, bool projectOnly)
{
wxUnusedVar(config);
wxString errMsg;
ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg);
if(!p) { return wxEmptyString; }
BuildConfigPtr bldConf = clCxxWorkspaceST::Get()->GetProjBuildConf(project, config);
wxString cmd;
wxString projectMakefile;
projectMakefile << p->GetName() << ".mk";
::WrapWithQuotes(projectMakefile);
projectMakefile.Replace("\\", "/");
if(!projectOnly) {
// part of a greater makefile, use $(MAKE)
cmd << wxT("@cd \"") << p->GetFileName().GetPath() << wxT("\" && ");
cmd << "$(MAKE) -f " << projectMakefile;
} else {
// project only
cmd = bldConf->GetCompiler()->GetTool("MAKE");
if(!cmd.Contains("-f")) { cmd << " -f "; }
cmd << " " << projectMakefile;
}
return cmd;
}
示例9: OnBrowseCustomBuildWD
void PSCustomBuildPage::OnBrowseCustomBuildWD(wxCommandEvent& event)
{
DirSaver ds;
// Since all paths are relative to the project, set the working directory to the
// current project path
ProjectPtr p = ManagerST::Get()->GetProject(m_projectName);
if(p) {
wxSetWorkingDirectory(p->GetFileName().GetPath());
}
wxFileName fn(m_textCtrlCustomBuildWD->GetValue());
wxString initPath(wxEmptyString);
if(fn.DirExists()) {
fn.MakeAbsolute();
initPath = fn.GetFullPath();
}
wxString new_path =
wxDirSelector(_("Select working directory:"), initPath, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
if(new_path.IsEmpty() == false) {
m_textCtrlCustomBuildWD->SetValue(new_path);
}
}
示例10: OnExportMakefile
void QMakePlugin::OnExportMakefile(wxCommandEvent& event)
{
if(m_qmakeProcess) return;
QmakePluginData::BuildConfPluginData bcpd;
ProjectPtr pProj = m_mgr->GetSelectedProject();
CHECK_PTR_RET(pProj);
BuildConfigPtr bldConf = pProj->GetBuildConfiguration();
CHECK_PTR_RET(bldConf);
wxString project = pProj->GetName();
wxString config = bldConf->GetName();
if(!DoGetData(project, config, bcpd)) {
event.Skip();
return;
}
if(bcpd.m_enabled) {
// This project/configuration is qmake project
QMakeProFileGenerator generator(m_mgr, project, config);
// Regenerate the .pro file
generator.Generate();
// run qmake
wxString qmake_exe = m_conf->Read(wxString::Format(wxT("%s/qmake"), bcpd.m_qmakeConfig.c_str()));
wxString qmakespec = m_conf->Read(wxString::Format(wxT("%s/qmakespec"), bcpd.m_qmakeConfig.c_str()));
wxString qtdir = m_conf->Read(wxString::Format(wxT("%s/qtdir"), bcpd.m_qmakeConfig.c_str()));
// Create qmake comand
wxString qmake_exe_line;
qmake_exe.Trim().Trim(false);
qmakespec.Trim().Trim(false);
// Set QTDIR
DirSaver ds;
{
wxString errMsg;
ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg);
if(!p) { return; }
qmake_exe_line << wxT("\"") << qmake_exe << wxT("\" -spec ") << qmakespec << wxT(" ")
<< generator.GetProFileName();
wxStringMap_t om;
om.insert(std::make_pair("QTDIR", qtdir));
EnvSetter envGuard(NULL, &om, project, config);
m_mgr->ClearOutputTab(kOutputTab_Build);
m_mgr->AppendOutputTabText(kOutputTab_Build, wxString() << "-- " << qmake_exe_line << "\n");
m_qmakeProcess =
::CreateAsyncProcess(this, qmake_exe_line, IProcessCreateDefault, p->GetFileName().GetPath());
}
}
event.Skip();
}
示例11: NewClassBaseDlg
NewClassDlg::NewClassDlg(wxWindow* parent, IManager* mgr)
: NewClassBaseDlg(parent)
, m_selectedItem(wxNOT_FOUND)
, m_mgr(mgr)
{
NewClassDlgData data;
EditorConfigST::Get()->ReadObject(wxT("NewClassDlgData"), &data);
m_checkBoxCopyable->SetValue(data.GetFlags() & NewClassDlgData::NonCopyable);
m_checkBoxImplPureVirtual->SetValue(data.GetFlags() & NewClassDlgData::ImplAllPureVirtualFuncs);
m_checkBoxImplVirtual->SetValue(data.GetFlags() & NewClassDlgData::ImplAllVirtualFuncs);
m_checkBoxInline->SetValue(data.GetFlags() & NewClassDlgData::FileIniline);
m_checkBoxHpp->SetValue(data.GetFlags() & NewClassDlgData::HppHeader);
m_checkBoxSingleton->SetValue(data.GetFlags() & NewClassDlgData::Singleton);
m_checkBoxVirtualDtor->SetValue(data.GetFlags() & NewClassDlgData::VirtualDtor);
m_checkBoxPragmaOnce->SetValue(data.GetFlags() & NewClassDlgData::UsePragma);
// set two columns to our list
m_listCtrl1->InsertColumn(0, _("Name"));
m_listCtrl1->InsertColumn(1, _("Access"));
m_listCtrl1->InsertColumn(2, _("File"));
wxString vdPath;
TreeItemInfo item = mgr->GetSelectedTreeItemInfo(TreeFileView);
if(item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory) {
wxString path = VirtualDirectorySelectorDlg::DoGetPath(m_mgr->GetTree(TreeFileView), item.m_item, false);
if(path.IsEmpty() == false) {
m_textCtrlVD->ChangeValue(path);
}
}
// set the class path to be the active project path
wxString errMsg;
if(m_mgr->GetWorkspace()) {
wxString start_path;
if(item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory) {
m_basePath = item.m_fileName.GetPath(wxPATH_GET_VOLUME);
} else {
wxString projname = m_mgr->GetWorkspace()->GetActiveProjectName();
ProjectPtr proj = m_mgr->GetWorkspace()->FindProjectByName(projname, errMsg);
if(proj) {
m_basePath = proj->GetFileName().GetPath(wxPATH_GET_VOLUME);
}
}
}
DoUpdateGeneratedPath();
GetSizer()->Layout();
m_textClassName->SetFocus();
GetSizer()->Fit(this);
CentreOnParent();
}
示例12: PrepareCommand
wxString MemCheckPlugin::PrepareCommand(const wxString& projectName, wxString& wd)
{
wd.clear();
if(!clCxxWorkspaceST::Get()->IsOpen()) { return ""; }
ProjectPtr proj = clCxxWorkspaceST::Get()->GetProject(projectName);
if(!proj) {
clWARNING() << "MemCheckPlugin::PrepareCommand(): could not find project:" << projectName;
return wxEmptyString;
}
BuildConfigPtr bldConf = clCxxWorkspaceST::Get()->GetProjBuildConf(projectName, wxEmptyString);
if(!bldConf) {
clWARNING() << "MemCheckPlugin::PrepareCommand(): failed to find project configuration for project:"
<< projectName;
return wxEmptyString;
}
wxString projectPath = proj->GetFileName().GetPath();
// expand variables
wxString cmd = bldConf->GetCommand();
cmd = MacroManager::Instance()->Expand(cmd, NULL, projectName);
wxString cmdArgs = bldConf->GetCommandArguments();
cmdArgs = MacroManager::Instance()->Expand(cmdArgs, NULL, projectName);
// Execute command & cmdArgs
wd = bldConf->GetWorkingDirectory();
wd = MacroManager::Instance()->Expand(wd, NULL, projectName);
wxFileName workingDir(wd, "");
if(workingDir.IsRelative()) { workingDir.MakeAbsolute(projectPath); }
wxFileName fileExe(cmd);
if(fileExe.IsRelative()) { fileExe.MakeAbsolute(workingDir.GetPath()); }
fileExe.Normalize();
#ifdef __WXMSW__
if(!fileExe.Exists() && fileExe.GetExt().IsEmpty()) {
// Try with .exe
wxFileName withExe(fileExe);
withExe.SetExt("exe");
if(withExe.Exists()) { fileExe = withExe; }
}
#endif
wd = workingDir.GetPath();
cmd = fileExe.GetFullPath();
cmd = ::WrapWithQuotes(cmd);
cmd << " " << cmdArgs;
clDEBUG() << "Command to execute:" << cmd;
clDEBUG() << "Working directory:" << wd;
return cmd;
}
示例13: GetProjectDirectory
wxFileName CMakePlugin::GetProjectDirectory(const wxString& projectName) const
{
const clCxxWorkspace* workspace = m_mgr->GetWorkspace();
wxASSERT(workspace);
wxString errMsg;
const ProjectPtr proj = workspace->FindProjectByName(projectName, errMsg);
wxASSERT(proj);
return wxFileName::DirName(proj->GetFileName().GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME));
}
示例14: NewVirtualFolderDlgBase
NewVirtualFolderDlg::NewVirtualFolderDlg(wxWindow* parent, const wxString& currentVD)
: NewVirtualFolderDlgBase(parent)
{
m_checkBoxCreateOnDisk->SetValue( clConfig::Get().Read("CreateVirtualFoldersOnDisk", false) );
wxString project_name = currentVD.BeforeFirst(':');
wxString vd_path = currentVD.AfterFirst(':');
vd_path.Replace(":", wxFILE_SEP_PATH);
wxString errmsg;
ProjectPtr proj = WorkspaceST::Get()->FindProjectByName(project_name, errmsg);
wxString projectPath = proj->GetFileName().GetPath();
m_basePath = wxFileName(projectPath + wxFILE_SEP_PATH + vd_path, "").GetPath();
WindowAttrManager::Load(this, "NewVirtualFolderDlg");
}
示例15: OnBuildStarting
void QMakePlugin::OnBuildStarting(clBuildEvent& event)
{
// call Skip() to allow the standard compilation to take place
event.Skip();
QmakePluginData::BuildConfPluginData bcpd;
wxString project = event.GetProjectName();
wxString config = event.GetConfigurationName();
if ( !DoGetData(project, config, bcpd) ) {
return;
}
if ( !bcpd.m_enabled ) {
return;
}
wxString errMsg;
ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project, errMsg);
if ( !p ) {
return;
}
QMakeProFileGenerator generator(m_mgr, project, config);
// regenrate the .pro file
bool needRegeneration = generator.Generate();
wxString qmake_exe = m_conf->Read(wxString::Format(wxT("%s/qmake"), bcpd.m_qmakeConfig.c_str()));
wxString qmakespec = m_conf->Read(wxString::Format(wxT("%s/qmakespec"), bcpd.m_qmakeConfig.c_str()));
wxString qtdir = m_conf->Read(wxString::Format(wxT("%s/qtdir"), bcpd.m_qmakeConfig.c_str()));
// Create qmake comand
wxString qmake_exe_line;
qmake_exe.Trim().Trim(false);
qmakespec.Trim().Trim(false);
// Set QTDIR
DirSaver ds;
{
wxSetWorkingDirectory ( p->GetFileName().GetPath(wxPATH_GET_SEPARATOR|wxPATH_GET_VOLUME) );
wxSetEnv(wxT("QTDIR"), qtdir);
qmake_exe_line << wxT("\"") << qmake_exe << wxT("\" -spec ") << qmakespec << wxT(" ") << generator.GetProFileName();
if ( needRegeneration ) {
wxArrayString output;
ProcUtils::SafeExecuteCommand(qmake_exe_line, output);
}
}
}