您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wxSetWorkingDirectory函数代码示例

51自学网 2021-06-03 10:11:50
  C++
这篇教程C++ wxSetWorkingDirectory函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例4: revision

boolUpdateAction::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,


示例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,


示例6: ReadExecOpts

//Format and (optionally) execute commandbool 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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例13: client

boolMergeAction::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,


示例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,


示例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,


示例16: fopen

void WinEDA_MainFrame::Load_Prj_Config(void)/*******************************************/{FILE * in_file;	in_file = fopen(m_PrjFileName, "rt");	if ( in_file == 0 )		{		wxString msg = _("Project File <") + m_PrjFileName + _("> not found");		DisplayError(this, msg);		return;		}	fclose(in_file);	wxSetWorkingDirectory(wxPathOnly(m_PrjFileName) );	SetTitle(Main_Title + " " + m_PrjFileName);	ReCreateMenuBar();	m_LeftWin->ReCreateTreePrj();	wxString msg = _("/nWorking dir: ") + wxGetCwd();	msg << _("/nProject: ") << m_PrjFileName << "/n";	PrintMsg(msg);}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:23,


示例17: wxLogError

bool Spring::LaunchEngine(const std::string& cmd, wxArrayString& params){	if ( m_running ) {		wxLogError( _T("Spring already running!") );		return false;	}	if (cfg().ReadBool(_T( "/Spring/Safemode" ))) {		params.push_back(_T("--safemode"));	}	wxLogMessage( _T("spring call params: %s"), TowxString(cmd).c_str() );	wxSetWorkingDirectory( TowxString(SlPaths::GetDataDir()) );	if ( m_process == 0 ) {		m_process = new SpringProcess( *this );	}	m_process->Create();	m_process->SetCommand(TowxString(cmd), params );	m_process->Run();	m_running = true;	GlobalEvent::Send(GlobalEvent::OnSpringStarted);	return true;}
开发者ID:jgleesawn,项目名称:springlobby,代码行数:23,


示例18: mg_create_server

wxThread::ExitCode WebServerThread::Entry(){    // Get user setting    int webserverPort = Model_Setting::instance().GetIntSetting("WEBSERVERPORT", 8080);    const wxString& strPort = wxString::Format("%d", webserverPort);    // Create and configure the server    struct mg_server *server = mg_create_server(nullptr, ev_handler);    mg_set_option(server, "listening_port", strPort.mb_str());    mg_set_option(server, "document_root", wxFileName(mmex::getReportIndex()).GetPath().mb_str());    wxSetWorkingDirectory(mg_get_option(server, "document_root"));    // Serve requests     while (IsAlive())    {        mg_poll_server(server, 1000);    }    // Cleanup, and free server instance    mg_destroy_server(&server);    return (wxThread::ExitCode)0;}
开发者ID:4silvertooth,项目名称:moneymanagerex,代码行数:23,


示例19: S

void CShowDescriptionListDlg::SaveAs(){    int            err, i;    CBaseObject  * pObj;    CStr           S(128);    wxString CurrentDir = wxGetCwd();    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()))        {            for (i=0; i<m_pItems->Count(); i++)            {                pObj = (CBaseObject*)m_pItems->At(i);                S    = pObj->Description;                S.TrimRight(TRIM_ALL);                S << EOL_FILE;                F.WriteBuf(S.GetData(), S.GetLength());            }            F.Close();        }        else            wxMessageBox(wxT("Can not open file"));    }}
开发者ID:erwin47,项目名称:alh,代码行数:37,


示例20: SaveAbstractLayer

//Helperbool SaveAbstractLayer(vtAbstractLayer *alay, bool bAskFilename){	vtFeatureSet *fset = alay->GetFeatureSet();	vtString fname = fset->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 Abstract Data"), default_dir,			default_file, FSTRING_SHP, wxFD_SAVE);		bool bResult = (saveFile.ShowModal() == wxID_OK);		EnableContinuousRendering(true);		if (!bResult)		{			wxSetWorkingDirectory(path);	// restore			return false;		}		wxString str = saveFile.GetPath();		fname = str.mb_str(wxConvUTF8);		fset->SetFilename(fname);	}	bool success = fset->SaveToSHP(fname);	if (success)		alay->SetModified(false);	else		wxMessageBox(_("Couldn't save layer."));	return success;}
开发者ID:kamalsirsa,项目名称:vtp,代码行数:37,


示例21: mg_mgr_init

wxThread::ExitCode WebServerThread::Entry(){    // Get user setting    int webserverPort = Model_Setting::instance().GetIntSetting("WEBSERVERPORT", 8080);    const wxString& strPort = wxString::Format("%d", webserverPort);    // Create and configure the server    struct mg_mgr mgr;    mg_mgr_init(&mgr, NULL);    struct mg_connection* nc = mg_bind(&mgr, strPort.c_str(), ev_handler);    if (nc == nullptr)    {        wxLogDebug(wxString::Format("mg_bind(%s) failed", strPort));        mg_mgr_free(&mgr);        return (wxThread::ExitCode)-1;    }        mg_set_protocol_http_websocket(nc);    std::string document_root(wxFileName(mmex::getReportIndex()).GetPath().c_str());    s_http_server_opts.document_root = document_root.c_str();    s_http_server_opts.enable_directory_listing = "yes";    wxSetWorkingDirectory(wxString(s_http_server_opts.document_root));    // Serve requests     while (IsAlive())    {        mg_mgr_poll(&mgr, 1000);    }    // Cleanup, and free server instance    mg_mgr_free(&mgr);    return nullptr;}
开发者ID:dqf88,项目名称:moneymanagerex,代码行数:36,


示例22: WX_HOOK_MODAL_DIALOG

int wxDirDialog::ShowModal(){    WX_HOOK_MODAL_DIALOG();    wxWindow* const parent = GetParent();    WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;    // Use IFileDialog under new enough Windows, it's more user-friendly.    int rc;#if wxUSE_IFILEDIALOG    // While the new dialog is available under Vista, it may return a wrong    // path there (see http://support.microsoft.com/kb/969885/en-us), so we    // don't use it there by default. We could improve the version test to    // allow its use if the comdlg32.dll version is greater than 6.0.6002.22125    // as this means that the hotfix correcting this bug is installed.    if ( wxGetWinVersion() > wxWinVersion_Vista )    {        rc = ShowIFileDialog(hWndParent);    }    else    {        rc = wxID_NONE;    }    if ( rc == wxID_NONE )#endif // wxUSE_IFILEDIALOG    {        rc = ShowSHBrowseForFolder(hWndParent);    }    // change current working directory if asked so    if ( rc == wxID_OK && HasFlag(wxDD_CHANGE_DIR) )        wxSetWorkingDirectory(m_path);    return rc;}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:36,


示例23: GetParent

int SelectDirDialog::ShowModal(){    wxWindow *parent = GetParent();    BROWSEINFO bi;    bi.hwndOwner      = parent ? GetHwndOf(parent) : NULL;    bi.pidlRoot       = NULL;    bi.pszDisplayName = NULL;    // Please don't change this without checking it compiles    // with eVC++ first.    bi.lpszTitle      = m_message.c_str();    bi.ulFlags        = BIF_RETURNONLYFSDIRS;    bi.lpfn           = BrowseCallbackProc;    bi.lParam         = (LPARAM)this;    // param for the callback//  bi.ulFlags |= BIF_EDITBOX;    // do show the dialog    wxItemIdList pidl(SHBrowseForFolder(&bi));    wxItemIdList::Free((LPITEMIDLIST)bi.pidlRoot);    if ( !pidl )    {        // Cancel button pressed        return wxID_CANCEL;    }    m_path = pidl.GetPath();    // change current working directory if asked so    if (HasFlag(wxDD_CHANGE_DIR))        wxSetWorkingDirectory(m_path);    return m_path.empty() ? wxID_CANCEL : wxID_OK;}
开发者ID:stahta01,项目名称:EmBlocks_old,代码行数:36,


示例24: filename

//.........这里部分代码省略.........        ignoreChanges = true;        m_list->GoToHomeDir();        m_list->SetFocus();        UpdateControls();        ignoreChanges = false;        return;    }    if (filename.BeforeFirst(wxT('/')) == wxT("~"))    {        filename = wxString(wxGetUserHome()) + filename.Remove(0, 1);    }#endif // __UNIX__    if (!(m_dialogStyle & wxSAVE))    {        if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||                (filename.Find(wxT('?')) != wxNOT_FOUND))        {            if (filename.Find(wxFILE_SEP_PATH) != wxNOT_FOUND)            {                wxMessageBox(_("Illegal file specification."), _("Error"), wxOK | wxICON_ERROR );                return;            }            m_list->SetWild( filename );            return;        }    }    if (!IsTopMostDir(dir))        dir += wxFILE_SEP_PATH;    if (!wxIsAbsolutePath(filename))    {        dir += filename;        filename = dir;    }    if (wxDirExists(filename))    {        ignoreChanges = true;        m_list->GoToDir( filename );        UpdateControls();        ignoreChanges = false;        return;    }    // they really wanted a dir, but it doesn't exist    if (want_dir)    {        wxMessageBox(_("Directory doesn't exist."), _("Error"),                     wxOK | wxICON_ERROR );        return;    }    // append the default extension to the filename if it doesn't have any    //    // VZ: the logic of testing for !wxFileExists() only for the open file    //     dialog is not entirely clear to me, why don't we allow saving to a    //     file without extension as well?    if ( !(m_dialogStyle & wxOPEN) || !wxFileExists(filename) )    {        filename = AppendExtension(filename, m_filterExtension);    }    // check that the file [doesn't] exist if necessary    if ( (m_dialogStyle & wxSAVE) &&            (m_dialogStyle & wxOVERWRITE_PROMPT) &&            wxFileExists( filename ) )    {        wxString msg;        msg.Printf( _("File '%s' already exists, do you really want to overwrite it?"), filename.c_str() );        if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)            return;    }    else if ( (m_dialogStyle & wxOPEN) &&              (m_dialogStyle & wxFILE_MUST_EXIST) &&              !wxFileExists(filename) )    {        wxMessageBox(_("Please choose an existing file."), _("Error"),                     wxOK | wxICON_ERROR );    }    SetPath( filename );    // change to the directory where the user went if asked    if ( m_dialogStyle & wxCHANGE_DIR )    {        wxString cwd;        wxSplitPath(filename, &cwd, NULL, NULL);        if ( cwd != wxGetCwd() )        {            wxSetWorkingDirectory(cwd);        }    }    wxCommandEvent event;    wxDialog::OnOK(event);}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:101,


示例25: wd

/*static*/IProcess* WinProcessImpl::Execute(wxEvtHandler *parent, const wxString& cmd, wxString &errMsg, IProcessCreateFlags flags, const wxString &workingDir, IProcessCallback* cb){    SECURITY_ATTRIBUTES saAttr;    BOOL                fSuccess;    MyDirGuard dg;    wxString wd(workingDir);    if (workingDir.IsEmpty()) {        wd = wxGetCwd();    }    wxSetWorkingDirectory( wd );    // Set the bInheritHandle flag so pipe handles are inherited.    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);    saAttr.bInheritHandle = TRUE;    saAttr.lpSecurityDescriptor = NULL;    WinProcessImpl *prc = new WinProcessImpl(parent);    prc->m_callback = cb;    prc->m_flags = flags;    // The steps for redirecting child process's STDOUT:    //     1. Save current STDOUT, to be restored later.    //     2. Create anonymous pipe to be STDOUT for child process.    //     3. Set STDOUT of the parent process to be write handle to    //        the pipe, so it is inherited by the child process.    //     4. Create a noninheritable duplicate of the read handle and    //        close the inheritable read handle.    // Save the handle to the current STDOUT.    prc->hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE);    // Create a pipe for the child process's STDOUT.    if ( !CreatePipe( &prc->hChildStdoutRd, &prc->hChildStdoutWr, &saAttr, 0) ) {        delete prc;        return NULL;    }    // Set a write handle to the pipe to be STDOUT.    if ( !SetStdHandle(STD_OUTPUT_HANDLE, prc->hChildStdoutWr) ) {        delete prc;        return NULL;    }    // Create noninheritable read handle and close the inheritable read handle.    fSuccess = DuplicateHandle( GetCurrentProcess(), prc->hChildStdoutRd,                                GetCurrentProcess(),  &prc->hChildStdoutRdDup ,                                0,  FALSE,                                DUPLICATE_SAME_ACCESS );    if ( !fSuccess ) {        delete prc;        return NULL;    }    CloseHandle( prc->hChildStdoutRd );    // The steps for redirecting child process's STDERR:    //     1. Save current STDERR, to be restored later.    //     2. Create anonymous pipe to be STDERR for child process.    //     3. Set STDERR of the parent process to be write handle to    //        the pipe, so it is inherited by the child process.    //     4. Create a noninheritable duplicate of the read handle and    //        close the inheritable read handle.    // Save the handle to the current STDERR.    prc->hSaveStderr = GetStdHandle(STD_ERROR_HANDLE);    // Create a pipe for the child process's STDERR.    if ( !CreatePipe( &prc->hChildStderrRd, &prc->hChildStderrWr, &saAttr, 0) ) {        delete prc;        return NULL;    }    // Set a write handle to the pipe to be STDERR.    if ( !SetStdHandle(STD_ERROR_HANDLE, prc->hChildStderrWr) ) {        delete prc;        return NULL;    }    // Create noninheritable read handle and close the inheritable read handle.    fSuccess = DuplicateHandle( GetCurrentProcess(), prc->hChildStderrRd,                                GetCurrentProcess(),  &prc->hChildStderrRdDup ,                                0,  FALSE,                                DUPLICATE_SAME_ACCESS );    if ( !fSuccess ) {        delete prc;        return NULL;    }    CloseHandle( prc->hChildStderrRd );    // The steps for redirecting child process's STDIN:    //     1.  Save current STDIN, to be restored later.    //     2.  Create anonymous pipe to be STDIN for child process.    //     3.  Set STDIN of the parent to be the read handle to the    //         pipe, so it is inherited by the child process.    //     4.  Create a noninheritable duplicate of the write handle,    //         and close the inheritable write handle.    // Save the handle to the current STDIN.    prc->hSaveStdin = GetStdHandle(STD_INPUT_HANDLE);//.........这里部分代码省略.........
开发者ID:Bloodknight,项目名称:codelite,代码行数:101,


示例26: if

//.........这里部分代码省略.........    {        LogMessage(wxString::Format(_("WARNING: Unprocessed Tools Plus Menu Message: ID %i, IDbase %i, IDend %i, num items on menu %i"),ID,ID_ContextMenu_0,ID_ContextMenu_49,(int)m_contextvec.size()));        return;    }    m_RunTarget.Replace(_T("*"),_T(" "));    bool setdir=true;    commandstr.Replace(_("$file"),wxFileName(m_RunTarget).GetShortPath());    commandstr.Replace(_("$relfile"),wxFileName(m_RunTarget).GetFullName());    commandstr.Replace(_("$fname"),wxFileName(m_RunTarget).GetName());    commandstr.Replace(_("$fext"),wxFileName(m_RunTarget).GetExt());    commandstr.Replace(_("$dir"),wxFileName(m_RunTarget).GetShortPath());    commandstr.Replace(_("$reldir"),wxFileName(m_RunTarget).GetFullName());    commandstr.Replace(_("$path"),wxFileName(m_RunTarget).GetShortPath());    commandstr.Replace(_("$relpath"),wxFileName(m_RunTarget).GetFullPath());    if (commandstr.Replace(_("$mpaths"),m_RunTarget)>0)        setdir=false;    // substitute user prompted values in the format: $inputstr{Enter your message}    int promptind=commandstr.Find(_("$inputstr{"));    wxString substitution;    while (promptind>=0)    {        int promptend=commandstr.Mid(promptind+10).Find(_("}"));        if (promptend<=0)        {            cbMessageBox(_("Malformed $inputstr in command line -- no closing '}' found: ")+commandstr);            return;        }        else            promptend++;        wxTextEntryDialog ted(NULL,commandstr.Mid(promptind+10,promptend-1),consolename,_T(""),wxOK|wxCANCEL);        if (ted.ShowModal()==wxID_OK)            substitution=ted.GetValue();        else            return;        commandstr=commandstr.Left(promptind)+substitution+commandstr.Mid(promptind+10+promptend);        int nextind=commandstr.Mid(promptind+substitution.Len()).Find(_("$inputstr"));        if (nextind>=0)            promptind+=nextind+substitution.Len();        else            promptind=-1;    }    commandstr.Replace(_("$interpreter"),wxFileName(m_ic.interps[m_interpnum].command).GetShortPath());    workingdir.Replace(_("$parentdir"),wxFileName(m_RunTarget).GetPath());    if (wxFileName::DirExists(m_RunTarget))        workingdir.Replace(_("$dir"),wxFileName(m_RunTarget).GetFullPath());    if (Manager::Get()->GetMacrosManager())    {        Manager::Get()->GetMacrosManager()->RecalcVars(0, 0, 0); // hack to force-update macros        Manager::Get()->GetMacrosManager()->ReplaceMacros(commandstr);        Manager::Get()->GetMacrosManager()->ReplaceMacros(workingdir);    }    wxString olddir=wxGetCwd();    if (setdir && workingdir!=_T(""))    {        if (!wxSetWorkingDirectory(workingdir))        {            LogMessage(_("Tools Plus Plugin: Can't change to working directory to ")+workingdir);            return;        }    }    LogMessage(wxString::Format(_("Launching '%s': %s (in %s)"), consolename.c_str(), commandstr.c_str(), workingdir.c_str()));    if (windowed)    {        wxArrayString astr;        m_shellmgr->LaunchProcess(commandstr,consolename,_("Piped Process Control"),astr);        ShowConsole();    } else if (console)    {        wxString cmdline;#ifndef __WXMSW__        // for non-win platforms, use m_ConsoleTerm to run the console app        wxString term = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/console_terminal"), DEFAULT_CONSOLE_TERM);        term.Replace(_T("$TITLE"), _T("'") + consolename + _T("'"));        cmdline<< term << _T(" ");        #define CONSOLE_RUNNER "cb_console_runner"#else        #define CONSOLE_RUNNER "cb_console_runner.exe"#endif        wxString baseDir = ConfigManager::GetExecutableFolder();        if (wxFileExists(baseDir + wxT("/" CONSOLE_RUNNER)))            cmdline << baseDir << wxT("/" CONSOLE_RUNNER " ");        cmdline<<commandstr;        if (!wxExecute(cmdline))            cbMessageBox(_("Command Launch Failed: ")+commandstr);    }    else    {        if (!wxExecute(commandstr))            cbMessageBox(_("Command Launch Failed: ")+commandstr);    }    wxSetWorkingDirectory(olddir);}
开发者ID:stahta01,项目名称:EmBlocks,代码行数:101,


示例27: wxSetWorkingDirectory

 ~MyDirGuard() {     wxSetWorkingDirectory(_d); }
开发者ID:Bloodknight,项目名称:codelite,代码行数:3,


示例28: InitLanguageSupport

//.........这里部分代码省略.........	// TODO:  This currently has no effect.  Implement or delete.	selectAudioEmulation = parser.Found(wxT("audio_emulation"),		&audioEmulationName);#endif // wxUSE_CMDLINE_PARSER#if defined _DEBUG && defined _WIN32	int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);	tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;	_CrtSetDbgFlag(tmpflag);#endif	// Register message box and translation handlers	RegisterMsgAlertHandler(&wxMsgAlert);	RegisterStringTranslator(&wxStringTranslator);	// "ExtendedTrace" looks freakin dangerous!!!#ifdef _WIN32	EXTENDEDTRACEINITIALIZE(".");	SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);#elif wxUSE_ON_FATAL_EXCEPTION	wxHandleFatalExceptions(true);#endif	// TODO: if First Boot	if (!cpu_info.bSSE2) 	{		PanicAlertT("Hi,/n/nDolphin requires that your CPU has support for SSE2 extensions./n"				"Unfortunately your CPU does not support them, so Dolphin will not run./n/n"				"Sayonara!/n");		return false;	}#ifdef _WIN32	if (!wxSetWorkingDirectory(wxString(File::GetExeDirectory().c_str(), *wxConvCurrent)))	{		INFO_LOG(CONSOLE, "set working directory failed");	}#else	//create all necessary directories in user directory	//TODO : detect the revision and upgrade where necessary	File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP),			File::GetUserPath(D_GAMECONFIG_IDX));	File::CopyDir(std::string(SHARED_USER_DIR MAPS_DIR DIR_SEP),			File::GetUserPath(D_MAPS_IDX));	File::CopyDir(std::string(SHARED_USER_DIR SHADERS_DIR DIR_SEP),			File::GetUserPath(D_SHADERS_IDX));	File::CopyDir(std::string(SHARED_USER_DIR WII_USER_DIR DIR_SEP),			File::GetUserPath(D_WIIUSER_IDX));	File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP),			File::GetUserPath(D_OPENCL_IDX));	if (!File::Exists(File::GetUserPath(D_CONFIG_IDX)))		File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));	if (!File::Exists(File::GetUserPath(D_GCUSER_IDX)))		File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));	if (!File::Exists(File::GetUserPath(D_CACHE_IDX)))		File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));	if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX)))		File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));	if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX)))		File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));	if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX)))		File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));	if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX)))		File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));	if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX)))
开发者ID:NullNoname,项目名称:dolphin,代码行数:67,



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


C++ wxSizeEventHandler函数代码示例
C++ wxSetEnv函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。