当前位置: 首页>>代码示例>>C++>>正文


C++ wxSetWorkingDirectory函数代码示例

本文整理汇总了C++中wxSetWorkingDirectory函数的典型用法代码示例。如果您正苦于以下问题:C++ wxSetWorkingDirectory函数的具体用法?C++ wxSetWorkingDirectory怎么用?C++ wxSetWorkingDirectory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxSetWorkingDirectory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ClearOutputWindow

void CscopePlugin::DoCscopeCommand(const wxString &cmd, const wxString &endMsg)
{
    ClearOutputWindow();
	MakeOutputPaneVisible();
	m_CscouptOutput.clear();

    cbProject * prj = Manager::Get()->GetProjectManager()->GetActiveProject();
    wxString path;
    if ( prj )
        path = prj->GetBasePath();

    Manager::Get()->GetLogManager()->Log(cmd);
    m_EndMsg = endMsg;

    if ( m_pProcess ) return;


    wxString curDir = wxGetCwd();
	wxSetWorkingDirectory(path);
    //set environment variables for cscope
	wxSetEnv(_T("TMPDIR"), _T("."));

    m_view->GetWindow()->SetMessage(_T("Executing cscope..."), 10);

	m_pProcess = new CscopeProcess(this);
    if ( !wxExecute(cmd, wxEXEC_ASYNC|wxEXEC_MAKE_GROUP_LEADER, m_pProcess) )
    {
        delete m_pProcess;
        m_pProcess = NULL;
        m_view->GetWindow()->SetMessage(_T("Error while calling cscope occurred!"), 0);
    }

    //set environment variables back
    Manager::Get()->GetLogManager()->Log(_T("cscope process started"));
    wxSetWorkingDirectory(curDir);
}
开发者ID:stahta01,项目名称:EmBlocks_old,代码行数:36,代码来源:CscopePlugin.cpp

示例2: wxLogError

bool Spring::LaunchSpring( const wxString& params  )
{
  if ( m_running )
  {
    wxLogError( _T("Spring already running!") );
    return false;
  }
    if ( !wxFile::Exists( sett().GetCurrentUsedSpringBinary() ) ) {
        customMessageBoxNoModal( SL_MAIN_ICON, _T("The spring executable was not found at the set location, please re-check."), _T("Executable not found") );
        ui().mw().ShowConfigure( MainWindow::OPT_PAGE_SPRING );
        return false;
    }

  wxString configfileflags = sett().GetCurrentUsedSpringConfigFilePath();
  if ( !configfileflags.IsEmpty() )
  {

		configfileflags = _T("--config=\"") + configfileflags + _T("\" ");
		#ifdef __WXMSW__
		if ( usync().GetSpringVersion().Find(_T("0.78.") ) != wxNOT_FOUND ) configfileflags = _T("");
		#endif
  }

  wxString cmd =  _T("\"") + sett().GetCurrentUsedSpringBinary();
  #ifdef __WXMAC__
    wxChar sep = wxFileName::GetPathSeparator();
	if ( sett().GetCurrentUsedSpringBinary().AfterLast(_T('.')) == _T("app") )
        cmd += sep + wxString(_T("Contents")) + sep + wxString(_T("MacOS")) + sep + wxString(_T("spring")); // append app bundle inner path
  #endif
  cmd += _T("\" ") + configfileflags + params;
  wxLogMessage( _T("spring call params: %s"), cmd.c_str() );
  wxSetWorkingDirectory( sett().GetCurrentUsedDataDir() );
  if ( sett().UseOldSpringLaunchMethod() )
  {
    if ( m_wx_process == 0 ) m_wx_process = new wxSpringProcess( *this );
    if ( wxExecute( cmd , wxEXEC_ASYNC, m_wx_process ) == 0 ) return false;
  }
  else
  {
    if ( m_process == 0 ) m_process = new SpringProcess( *this );
    m_process->Create();
    m_process->SetCommand( cmd );
    m_process->Run();
  }

  m_running = true;
  return true;
}
开发者ID:tvo,项目名称:springlobby,代码行数:48,代码来源:spring.cpp

示例3: wxSetWorkingDirectory

void CppLayoutPreviewer::PlayPreview()
{
    playing = true;

    if ( wxDirExists(wxFileName::FileName(editor.GetProject().GetProjectFile()).GetPath()))
        wxSetWorkingDirectory(wxFileName::FileName(editor.GetProject().GetProjectFile()).GetPath());
    std::cout << previewScene.GetProfiler() << "<-" << std::endl;
    if ( externalPreviewWindow ) externalPreviewWindow->Show(false);
    previewScene.ChangeRenderWindow(&editor);

    if ( debugger ) debugger->Play();

    mainFrameWrapper.GetRibbonSceneEditorButtonBar()->EnableButton(idRibbonPlay, false);
    mainFrameWrapper.GetRibbonSceneEditorButtonBar()->EnableButton(idRibbonPause, true);
    mainFrameWrapper.GetRibbonSceneEditorButtonBar()->EnableButton(idRibbonPlayWin, true);
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:16,代码来源:CppLayoutPreviewer.cpp

示例4: revision

bool
UpdateAction::Perform()
{
  svn::Revision revision(svn::Revision::HEAD);
  // Did the user request a specific revision?:
  if (!m_data.useLatest)
  {
    TrimString(m_data.revision);
    if (!m_data.revision.IsEmpty())
    {
      svn_revnum_t revnum;
      m_data.revision.ToLong(&revnum, 10);  // If this fails, revnum is unchanged.
      revision = svn::Revision(revnum);
    }
  }

  const wxString & dir = Utf8ToLocal(GetPath().c_str());
  if (!dir.empty())
    wxSetWorkingDirectory(dir);
  svn::Client client(GetContext());

  svn_depth_t depth = svn_depth_unknown;
  switch (m_data.depth) {
  default:
  case UPDATE_WORKING_COPY:
    depth = svn_depth_unknown;
    break;
  case UPDATE_FULLY_RECURSIVE:
    depth = svn_depth_infinity;
    break;
  case UPDATE_IMMEDIATES:
    depth = svn_depth_immediates;
    break;
  case UPDATE_FILES:
    depth = svn_depth_files;
    break;
  case UPDATE_EMPTY:
    depth = svn_depth_empty;
    break;
  }

  client.update(GetTargets(), revision,
                depth, m_data.stickyDepth,
                m_data.ignoreExternals);

  return true;
}
开发者ID:RapidSVN,项目名称:RapidSVN,代码行数:47,代码来源:update_action.cpp

示例5: f

bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path)
{
   // Since we now have builtin VST support, ignore the VST bridge as it
   // causes duplicate menu entries to appear.
   wxFileName f(path);
   if (f.GetName().CmpNoCase(wxT("vst-bridge")) == 0) {
      return false;
   }

   // As a courtesy to some plug-ins that might be bridges to
   // open other plug-ins, we set the current working
   // directory to be the plug-in's directory.
   wxString envpath;
   bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
   wxSetEnv(wxT("PATH"), f.GetPath() + wxFILE_SEP_PATH + envpath);
   wxString saveOldCWD = f.GetCwd();
   f.SetCwd();
   
   int index = 0;
   LADSPA_Descriptor_Function mainFn = NULL;
   wxDynamicLibrary lib;
   if (lib.Load(path, wxDL_NOW)) {
      wxLogNull logNo;

      mainFn = (LADSPA_Descriptor_Function) lib.GetSymbol(wxT("ladspa_descriptor"));
      if (mainFn) {
         const LADSPA_Descriptor *data;

         for (data = mainFn(index); data; data = mainFn(++index)) {
            LadspaEffect effect(path, index);
            if (effect.SetHost(NULL)) {
               pm.RegisterPlugin(this, &effect);
            }
         }
      }
   }

   if (lib.IsLoaded()) {
      lib.Unload();
   }

   wxSetWorkingDirectory(saveOldCWD);
   hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));

   return index > 0;
}
开发者ID:QuincyPYoung,项目名称:audacity,代码行数:46,代码来源:LadspaEffect.cpp

示例6: ReadExecOpts

//Format and (optionally) execute command
bool ExecInput::FormatCommand(const GameType *gtype, const wxString &host, int port,
                              const wxString &password, const wxString &name, 
                              wxString *out, bool execute)
{
    wxString path, order, conn, pass, nm;
    wxString command;
 
    ReadExecOpts(gtype, &path, &order, &conn, &pass, &nm);
    
    if (path.IsEmpty() || order.IsEmpty() || conn.IsEmpty())
        return false;
        
    VarMap vmap, optmap;

    vmap["host"] = host;
    vmap["port"] = wxString::Format("%d", port);

    optmap["connect_opt"] = VarSubst(conn, vmap);
    

    if (!password.IsEmpty() && !pass.IsEmpty())
    {
        vmap["password"] = password;
        optmap["password_opt"] = VarSubst(pass, vmap);
    }
    
    if (!name.IsEmpty() && !nm.IsEmpty())
    {
        vmap["name"] = name;
        optmap["name_opt"] = VarSubst(nm, vmap);
    }

    wxFileName exec(path);
    exec.Normalize();
    
    wxSetWorkingDirectory(exec.GetPath());  
 
    command = exec.GetFullPath() + _T(" ") + VarSubst(order, optmap);
    if (out) 
        *out = command;
    
    if (execute)
        wxExecute(command);   
 
    return true;
}
开发者ID:cdrttn,项目名称:fragmon,代码行数:47,代码来源:ExecInput.cpp

示例7: getActiveLayer

/*
 * Read a EXCELLON file.
 * Gerber classes are used because there is likeness between Gerber files
 * and Excellon files
 * DCode can easily store T code (tool size) as round (or oval) shape
 * Drill commands are similar to flashed gerber items
 * Routing commands are similar to Gerber polygons
 * coordinates have the same format as Gerber, can be given in:
 *   decimal format (i.i. floating notation format)
 *   integer 2.4 format in imperial units,
 *   integer 3.2 or 3.3 format (metric units).
 */
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
    wxString msg;
    int layerId = getActiveLayer();      // current layer used in GerbView
    EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) g_GERBER_List.GetGbrImage( layerId );

    if( drill_Layer == NULL )
    {
        drill_Layer = new EXCELLON_IMAGE( this, layerId );
        layerId = g_GERBER_List.AddGbrImage( drill_Layer, layerId );
    }

    if( layerId < 0 )
    {
        DisplayError( this, _( "No room to load file" ) );
        return false;
    }

    ClearMessageList();

    // Read the Excellon drill file:
    FILE * file = wxFopen( aFullFileName, wxT( "rt" ) );

    if( file == NULL )
    {
        msg.Printf( _( "File %s not found" ), GetChars( aFullFileName ) );
        DisplayError( this, msg );
        return false;
    }

    wxString path = wxPathOnly( aFullFileName );

    if( path != wxEmptyString )
        wxSetWorkingDirectory( path );

    bool success = drill_Layer->Read_EXCELLON_File( file, aFullFileName );

    // Display errors list
    if( m_Messages.size() > 0 )
    {
        HTML_MESSAGE_BOX dlg( this, _( "Error reading EXCELLON drill file" ) );
        dlg.ListSet( m_Messages );
        dlg.ShowModal();
    }
    return success;
}
开发者ID:ejs-ejs,项目名称:kicad-source-mirror,代码行数:58,代码来源:excellon_read_drill_file.cpp

示例8: InstallDebugAssertOutputHandler

bool wxApp::Initialize(int& argc, wxChar **argv)
{
    // Mac-specific

#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON
    InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );
#endif

    // Mac OS X passes a process serial number command line argument when
    // the application is launched from the Finder. This argument must be
    // removed from the command line arguments before being handled by the
    // application (otherwise applications would need to handle it)
    if ( argc > 1 )
    {
        static const wxChar *ARG_PSN = wxT("-psn_");
        if ( wxStrncmp(argv[1], ARG_PSN, wxStrlen(ARG_PSN)) == 0 )
        {
            // remove this argument
            --argc;
            memmove(argv + 1, argv + 2, argc * sizeof(char *));
        }
    }

    if ( !wxAppBase::Initialize(argc, argv) )
        return false;

#if wxUSE_INTL
    wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
#endif

    // these might be the startup dirs, set them to the 'usual' dir containing the app bundle
    wxString startupCwd = wxGetCwd() ;
    if ( startupCwd == wxT("/") || startupCwd.Right(15) == wxT("/Contents/MacOS") )
    {
        CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ;
        CFURLRef urlParent = CFURLCreateCopyDeletingLastPathComponent( kCFAllocatorDefault , url ) ;
        CFRelease( url ) ;
        CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ;
        CFRelease( urlParent ) ;
        wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding());
        wxSetWorkingDirectory( cwd ) ;
    }

    return true;
}
开发者ID:NullNoname,项目名称:dolphin,代码行数:45,代码来源:app.cpp

示例9: VTLOG1

void EnviroFrame::Snapshot(bool bNumbered)
{
	VTLOG1("EnviroFrame::Snapshot\n");

	wxString use_name;
	if (!bNumbered || (bNumbered && m_strSnapshotFilename == _T("")))
	{
		// save current directory
		wxString path = wxGetCwd();

		wxString filter = FSTRING_JPEG _T("|") FSTRING_BMP _T("|") FSTRING_PNG
			_T("|") FSTRING_TIF;
		EnableContinuousRendering(false);
		wxFileDialog saveFile(NULL, _("Save View Snapshot"), _T(""), _T(""),
			filter, wxFD_SAVE);
		bool bResult = (saveFile.ShowModal() == wxID_OK);
		EnableContinuousRendering(true);
		if (!bResult)
		{
			wxSetWorkingDirectory(path);	// restore
			return;
		}
		if (bNumbered)
		{
			m_strSnapshotFilename = saveFile.GetPath();
			m_iSnapshotNumber = 0;
		}
		else
			use_name = saveFile.GetPath();
	}
	if (bNumbered)
	{
		// Append the number of the snapshot to the filename
		wxString start, number, extension;
		start = m_strSnapshotFilename.BeforeLast(_T('.'));
		extension = m_strSnapshotFilename.AfterLast(_T('.'));
		number.Printf(_T("_%03d."), m_iSnapshotNumber);
		m_iSnapshotNumber++;
		use_name = start + number + extension;
	}

	std::string Filename(use_name.mb_str(wxConvUTF8));
	CScreenCaptureHandler::SetupScreenCapture(Filename);
}
开发者ID:seanisom,项目名称:vtp,代码行数:44,代码来源:EnviroFrame.cpp

示例10: VTLOG1

bool EnviroGUI::SaveStructures(bool bAskFilename)
{
	VTLOG1("EnviroGUI::SaveStructures\n");

	vtStructureLayer *st_layer = GetCurrentTerrain()->GetStructureLayer();
	vtString fname = st_layer->GetFilename();
	if (bAskFilename)
	{
		// save current directory
		wxString path = wxGetCwd();

		wxString default_file(StartOfFilename(fname), wxConvUTF8);
		wxString default_dir(ExtractPath(fname, false), wxConvUTF8);

		EnableContinuousRendering(false);
		wxFileDialog saveFile(NULL, _("Save Built Structures Data"),
			default_dir, default_file, FSTRING_VTST,
			wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
		bool bResult = (saveFile.ShowModal() == wxID_OK);
		EnableContinuousRendering(true);
		if (!bResult)
		{
			wxSetWorkingDirectory(path);	// restore
			return false;
		}
		wxString str = saveFile.GetPath();
		fname = str.mb_str(wxConvUTF8);
		st_layer->SetFilename(fname);
	}
	bool success = false;
	try {
		success = st_layer->WriteXML(fname);
	}
	catch (xh_io_exception &e)
	{
		string str = e.getFormattedMessage();
		VTLOG("  Error: %s\n", str.c_str());
		wxMessageBox(wxString(str.c_str(), wxConvUTF8), _("Error"));
	}
	if (success)
		st_layer->SetModified(false);
	return success;
}
开发者ID:kamalsirsa,项目名称:vtp,代码行数:43,代码来源:EnviroGUI.cpp

示例11: if

bool ALMRunConfig::set(const wxString& name,const wxString &value)
{
	if (name.Cmp("Explorer") == 0)
		Explorer = value;
	else if (name.Cmp("Root") == 0)
	{
		Root = value;
		if (Root.empty())
			return false;
		wxSetWorkingDirectory(Root);
	}
	else if(name.Cmp("HotKey") == 0)
		HotKey = value;
	else if(name.Cmp("HotKeyReLoad") == 0)
		HotKeyReLoad = value;
	else
		return false;
	return ::wxSetEnv(wxT("ALMRUN_")+name.Upper(),value);
}
开发者ID:zdwzkl,项目名称:ALMRun,代码行数:19,代码来源:ALMRunConfig.cpp

示例12: _

void WinEDA_MainFrame::Load_Prj_Config(void)
/*******************************************/
{

	if ( ! wxFileExists(m_PrjFileName) )
	{
		wxString msg = _("Project File <") + m_PrjFileName + _("> not found");
		DisplayError(this, msg);
		return;
	}

	wxSetWorkingDirectory(wxPathOnly(m_PrjFileName) );
	SetTitle(g_Main_Title + wxT(" ") + GetBuildVersion() + wxT(" ") + m_PrjFileName);
	ReCreateMenuBar();
	m_LeftWin->ReCreateTreePrj();

	wxString msg = _("\nWorking dir: ") + wxGetCwd();
	msg << _("\nProject: ") << m_PrjFileName << wxT("\n");
	PrintMsg(msg);
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:20,代码来源:prjconfig.cpp

示例13: client

bool
MergeAction::Perform()
{
  svn::Client client(GetContext());

  // Set current working directory to the path where the
  // merge will be performed. If Destination is a file and not a
  // directory, only the directory part should be used
  wxFileName path(m_data.Destination);
  if (!wxSetWorkingDirectory(path.GetPath(wxPATH_GET_VOLUME)))
  {
    wxString msg;
    msg.Printf(_("Could not set working directory to %s"),
               path.GetPath(wxPATH_GET_VOLUME).c_str());
    TraceError(msg);
    return false;
  }

  svn_revnum_t rev1 = 0;
  svn_revnum_t rev2 = 0;

  if (!m_data.Path1Rev.ToLong(&rev1) || !m_data.Path2Rev.ToLong(&rev2))
  {
    wxString msg = _("Invalid revision number detected");
    TraceError(msg);
    return false;
  }

  svn::Path path1Utf8(PathUtf8(m_data.Path1));
  svn::Path path2Utf8(PathUtf8(m_data.Path2));
  svn::Path destinationUtf8(PathUtf8(m_data.Destination));
  client.merge(path1Utf8,
               rev1,
               path2Utf8,
               rev2,
               destinationUtf8,
               m_data.Force,
               m_data.Recursive);
  return true;
}
开发者ID:RapidSVN,项目名称:RapidSVN,代码行数:40,代码来源:merge_action.cpp

示例14: wxGetCwd

void CShowOneDescriptionDlg::OnButton(wxCommandEvent& event)
{
    if (event.GetId()==wxID_OK)
    {
        int         err;
        wxString CurrentDir = wxGetCwd();
        if (!m_descr)
            return;
        wxFileDialog dialog(GetParent(),
                            wxT("Save current text"),
                            wxT(""),
                            wxT(""),
                            wxT(SZ_ALL_FILES),
                            wxFD_SAVE |  wxFD_OVERWRITE_PROMPT );
        err = dialog.ShowModal();
        wxSetWorkingDirectory(CurrentDir);

        if (wxID_OK == err)
        {
            CFileWriter F;
            if (F.Open(dialog.GetPath().mb_str()))
            {
                F.WriteBuf(m_descr, strlen(m_descr));

                F.Close();
            }
            else
                wxMessageBox(wxT("Can not open file"));

        }

    }
    else if (event.GetId()==wxID_CANCEL)
    {
        StoreSize();
        EndModal(wxID_CANCEL);
    }
}
开发者ID:erwin47,项目名称:alh,代码行数:38,代码来源:utildlgs.cpp

示例15: wxSetWorkingDirectory

void dlg_options::OnStartLogging(wxCommandEvent &event)
{
	if (m_frame->m_child->IsLogging())
	{
		m_frame->m_child->SetLogging(false);
		m_startlog->SetLabel(_("Start logging"));
	}
	else
	{
		m_frame->m_child->SetLogging(true);
		m_startlog->SetLabel(_("Stop logging"));
		m_frame->m_child->SetHtmlLogging(m_logopts->GetSelection()==0);
		m_frame->m_child->SetAnsiLogging(m_logopts->GetSelection()==2);
		m_frame->m_child->SetDateLogging(m_ts->GetValue());
		m_frame->m_child->SetInclude(m_includescroll->GetValue());
		wxString path = m_dirPicker1->GetPath();
		wxString file = m_logfile->GetValue();
		wxSetWorkingDirectory(path);
		wxFile *f = new wxFile(file, wxFile::write);
		
		if (m_frame->m_child->IsHtmlLogging())
		{
			m_frame->m_child->SetHtmlLog(f);
			m_frame->m_child->WriteHtmlHeader(f);
		}
		else
		{
			m_frame->m_child->SetTextLog(f);
		}
		if (m_frame->m_child->GetInclude())
		{
			for (int i =0;i<m_frame->m_child->m_curline-1;i++)
			{
				m_frame->m_child->SendLineToLog(i);
			}
		}
	}
}
开发者ID:oldjudge,项目名称:wxamcl,代码行数:38,代码来源:dialog_optionen.cpp


注:本文中的wxSetWorkingDirectory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。