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


C++ wxGetHomeDir函数代码示例

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


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

示例1: file

void frmReport::OnBrowseFile(wxCommandEvent &ev)
{
	if (rbHtml->GetValue())
	{
#ifdef __WXMSW__
		wxFileDialog file(this, _("Select output filename"), wxGetHomeDir(), txtHtmlFile->GetValue(),
		                  _("HTML files (*.html)|*.html|All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
#else
		wxFileDialog file(this, _("Select output filename"), wxGetHomeDir(), txtHtmlFile->GetValue(),
		                  _("HTML files (*.html)|*.html|All files (*)|*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
#endif

		if (file.ShowModal() == wxID_OK)
		{
			txtHtmlFile->SetValue(file.GetPath());
			OnChange(ev);
		}
	}
	else
	{
#ifdef __WXMSW__
		wxFileDialog file(this, _("Select output filename"), wxGetHomeDir(), txtXmlFile->GetValue(),
		                  _("XML files (*.xml)|*.xml|All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
#else
		wxFileDialog file(this, _("Select output filename"), wxGetHomeDir(), txtXmlFile->GetValue(),
		                  _("XML files (*.xml)|*.xml|All files (*)|*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
#endif

		if (file.ShowModal() == wxID_OK)
		{
			txtXmlFile->SetValue(file.GetPath());
			OnChange(ev);
		}
	}
}
开发者ID:apolyton,项目名称:pgadmin3,代码行数:35,代码来源:frmReport.cpp

示例2: get_pluckerhome_directory

// Looks up the root directory, as needed by get_plucker_directory.
// Don't use this function directly, use a get_plucker_directory() instead.
wxString get_pluckerhome_directory()
{ 
    wxString pluckerhome_directory; 
    
#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
    bool pluckerhome_exists;
    pluckerhome_exists = wxGetEnv( wxT( "PLUCKERHOME" ), &pluckerhome_directory );
    if ( ! pluckerhome_exists ) 
    {
        pluckerhome_directory = wxGetHomeDir() << wxT( "/.plucker" );
    }
#endif  

#ifdef __WXMAC__
    bool pluckerhome_exists;
    pluckerhome_exists = wxGetEnv( wxT( "PLUCKERHOME" ), &pluckerhome_directory );
    if ( ! pluckerhome_exists ) 
    {
        pluckerhome_directory = wxGetHomeDir() << wxT( "/Library/Plucker" );
    }
#endif  

#ifdef __WXMSW__
    bool pluckerhome_exists;
    pluckerhome_exists = wxGetEnv( wxT( "PLUCKERHOME" ), &pluckerhome_directory );
    if ( ! pluckerhome_exists ) 
    {
        pluckerhome_directory = wxGetHomeDir() << wxT( "/Application Data/Plucker" );
    }
#endif  

    return pluckerhome_directory;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker-1,代码行数:35,代码来源:configuration.cpp

示例3: wxGetCwd

bool wxTerminal::CheckForCD( const wxString &command, wxString &path )
{
	if ( command.IsEmpty() )               return false; // Returning true tells caller there's nothing else to do
	if ( command.Left(2) != wxT("cd") )    return false; // Not a cd attempt so return false so that RunCommand takes over
	if ( wxIsalpha( command.GetChar(2) ) ) return false; // This must be a real command beginning with cd???

	if ( command == wxT("cd.") || command == wxT("cd .") )  {
		path = wxGetCwd();
		return true;
	}

	if ( command == wxT("cd") || command == wxT("cd~") || command == wxT("cd ~") ) {
		path = wxGetHomeDir();
		return true;

	} else if ( command.Find(wxT("&&")) != wxNOT_FOUND ) {
		// a complex command: cd <somewhere> && ...
		return false;

	} else {
		// Otherwise it should be a real dir. Remove the initial cd, plus any white-space
		path = command.Mid( 2 );
		path << wxFileName::GetPathSeparator();
		path.Trim(false);
		wxFileName fn(path);
		fn.MakeAbsolute(m_workingDir);
		fn.Normalize();
		if( fn.DirExists() ) {
			path = fn.GetFullPath();
			return true;
		}
		return false;
	}
}
开发者ID:RVictor,项目名称:EmbeddedLite,代码行数:34,代码来源:wxterminal.cpp

示例4: WXUNUSED

void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) )
{
    wxGenericFileDialog dialog
    (
        this,
        _T("Testing open file dialog"),
        wxEmptyString,
        wxEmptyString,
        _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
    );

    dialog.SetDirectory(wxGetHomeDir());

    if (dialog.ShowModal() == wxID_OK)
    {
        wxString info;
        info.Printf(_T("Full file name: %s\n")
                    _T("Path: %s\n")
                    _T("Name: %s"),
                    dialog.GetPath().c_str(),
                    dialog.GetDirectory().c_str(),
                    dialog.GetFilename().c_str());
        wxMessageDialog dialog2(this, info, _T("Selected file"));
        dialog2.ShowModal();
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:26,代码来源:dialogs.cpp

示例5: getPathAttachment

/*
This function transforms mnemonic pathes to real one
For example %USERPROFILE%\MyBudget will be transformed to C:\Users\James\MyBudget
*/
const wxString mmex::getPathAttachment(const wxString &attachmentsFolder)
{
    if (attachmentsFolder == wxEmptyString)
        return wxEmptyString;

    wxString AttachmentsFolder = attachmentsFolder;
    const wxString sep = wxFileName::GetPathSeparator();
    const wxString LastDBPath = Model_Setting::instance().getLastDbPath();
    const wxString& LastDBFolder = wxFileName::FileName(LastDBPath).GetPath() + sep;
    const wxString& UserFolder = mmex::GetUserDir(false).GetPath() + sep;

    if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_USERPROFILE, &AttachmentsFolder))
        AttachmentsFolder.Prepend(wxGetHomeDir() + sep);
    else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_DOCUMENTS, &AttachmentsFolder))
        AttachmentsFolder.Prepend(wxStandardPaths::Get().GetDocumentsDir() + sep);
    else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_DATABASE, &AttachmentsFolder))
        AttachmentsFolder.Prepend(LastDBFolder);
    else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_APPDATA, &AttachmentsFolder))
        AttachmentsFolder.Prepend(UserFolder);

    if (AttachmentsFolder.Last() != sep)
        AttachmentsFolder.Append(sep);
    if (Model_Infotable::instance().GetBoolInfo("ATTACHMENTSSUBFOLDER", true))
        AttachmentsFolder += wxString::Format("MMEX_%s_Attachments%s", wxFileName::FileName(LastDBPath).GetName(), sep);

    return AttachmentsFolder;
}
开发者ID:omalleypat,项目名称:moneymanagerex,代码行数:31,代码来源:paths.cpp

示例6: wxGetHomeDir

void frmExport::OnBrowseFile(wxCommandEvent &ev)
{
    wxString directory;
    wxString filename;

    if (txtFilename->GetValue().IsEmpty())
        directory = wxGetHomeDir();
    else
    {
        directory = wxFileName(txtFilename->GetValue()).GetPath();
        filename = wxFileName(txtFilename->GetValue()).GetFullName();
    }

#ifdef __WXMSW__
    wxFileDialog file(this, _("Select export filename"), directory, filename, 
        _("CSV files (*.csv)|*.csv|Data files (*.dat)|*.dat|All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
#else
    wxFileDialog file(this, _("Select export filename"), directory, filename, 
        _("CSV files (*.csv)|*.csv|Data files (*.dat)|*.dat|All files (*)|*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
#endif

    if (file.ShowModal() == wxID_OK)
    {
        txtFilename->SetValue(file.GetPath());
        OnChange(ev);
    }
}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:27,代码来源:frmExport.cpp

示例7: wxASSERT_MSG

bool wxSingleInstanceChecker::Create(const wxString& name,
                                     const wxString& path)
{
    wxASSERT_MSG( !m_impl,
                  wxT("calling wxSingleInstanceChecker::Create() twice?") );

    // must have the file name to create a lock file
    wxASSERT_MSG( !name.empty(), wxT("lock file name can't be empty") );

    m_impl = new wxSingleInstanceCheckerImpl;

    wxString fullname = path;
    if ( fullname.empty() )
    {
        fullname = wxGetHomeDir();
    }

    if ( fullname.Last() != wxT('/') )
    {
        fullname += wxT('/');
    }

    fullname << name;

    return m_impl->Create(fullname);
}
开发者ID:70michal19,项目名称:dolphin,代码行数:26,代码来源:snglinst.cpp

示例8: wxGetHomeDir

void CGameListCtrl::BrowseForDirectory()
{
	wxString dirHome;
	wxGetHomeDir(&dirHome);

	// browse
	wxDirDialog dialog(this, _("Browse for a directory to add"), dirHome,
			wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);

	if (dialog.ShowModal() == wxID_OK)
	{
		std::string sPath(dialog.GetPath().mb_str());
		std::vector<std::string>::iterator itResult = std::find(
				SConfig::GetInstance().m_ISOFolder.begin(),
				SConfig::GetInstance().m_ISOFolder.end(), sPath);

		if (itResult == SConfig::GetInstance().m_ISOFolder.end())
		{
			SConfig::GetInstance().m_ISOFolder.push_back(sPath);
			SConfig::GetInstance().SaveSettings();
		}

		Update();
	}
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:25,代码来源:GameListCtrl.cpp

示例9: wxGetHomeDir

wxString wxGetHomeDir()
{
    wxString home;
    wxGetHomeDir(&home);

    return home;
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:7,代码来源:utilscmn.cpp

示例10: WXUNUSED

wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
{
    // VZ: the old code here never worked for user != "" anyhow! Moreover, it
    //     returned sometimes a malloc()'d pointer, sometimes a pointer to a
    //     static buffer and sometimes I don't even know what.
    static wxString s_home;

    return (wxChar *)wxGetHomeDir(&s_home);
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:9,代码来源:utils.cpp

示例11: dir

void COptions::InitSettingsDir()
{
	wxFileName fn;

	wxString dir(GetOption(OPTION_DEFAULT_SETTINGSDIR));
	if (!dir.empty())
	{
		wxStringTokenizer tokenizer(dir, _T("/\\"), wxTOKEN_RET_EMPTY_ALL);
		dir = _T("");
		while (tokenizer.HasMoreTokens())
		{
			wxString token = tokenizer.GetNextToken();
			if (token[0] == '$')
			{
				if (token[1] == '$')
					token = token.Mid(1);
				else
				{
					wxString value;
					if (wxGetEnv(token.Mid(1), &value))
						token = value;
				}
			}
			dir += token;
			const wxChar delimiter = tokenizer.GetLastDelimiter();
			if (delimiter)
				dir += delimiter;
		}

		fn = wxFileName(dir, _T(""));
		fn.Normalize(wxPATH_NORM_ALL, wxGetApp().GetDefaultsDir());
	}
	else
	{
#ifdef __WXMSW__
		wxChar buffer[MAX_PATH * 2 + 1];

		if (SUCCEEDED(SHGetFolderPath(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, buffer)))
		{
			fn = wxFileName(buffer, _T(""));
			fn.AppendDir(_T("FileZilla"));
		}
		else
		{
			// Fall back to directory where the executable is
			if (GetModuleFileName(0, buffer, MAX_PATH * 2))
				fn = buffer;
		}
#else
		fn = wxFileName(wxGetHomeDir(), _T(""));
		fn.AppendDir(_T(".filezilla"));
#endif
	}
	if (!fn.DirExists())
		wxMkdir(fn.GetPath(), 0700);
	SetOption(OPTION_DEFAULT_SETTINGSDIR, fn.GetPath());
}
开发者ID:jplee,项目名称:MILF,代码行数:57,代码来源:Options.cpp

示例12: wxGetUserHome

wxString wxGetUserHome(const wxString& user)
{
    wxString home;

    if (user.empty() || user == wxGetUserId())
        wxGetHomeDir(&home);

    return home;
}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:9,代码来源:utilsdos.cpp

示例13: DrawServer

void DrawApp::StartInstanceServer(FrameManager *frmmgr, ConfigManager *cfgmgr) {
	m_server = new DrawServer(frmmgr, cfgmgr);

	wxString service = wxGetHomeDir() + _T("/.draw3_socket");

	if (m_server->Create(service) == false) {
		wxLogError(_T("Failed to start server"));
		delete m_server;
	}
}
开发者ID:Strongc,项目名称:szarp,代码行数:10,代码来源:drawapp.cpp

示例14: wxT

/**
 * ヘルプを押した際のイベント
 */
void HelloWorld::OnAbout(wxCommandEvent& event) {

     wxString message = wxVERSION_STRING;
     message += wxT("にようこそ!\n\nこれはwxWidgetsの最小アプリです\n");
     message += wxGetOsDescription();
     message += wxT("環境で動作しています\n\n");
     message += wxGetHomeDir();

     wxMessageBox(message, wxT("このアプリケーションについて"), wxOK | wxICON_INFORMATION, this);
}
开发者ID:Hiroyuki-Nagata,项目名称:ForGoogleSite,代码行数:13,代码来源:HelloWorld.cpp

示例15: tmp

CLocalPath COptions::GetUnadjustedSettingsDir()
{
	CLocalPath ret;

#ifdef FZ_WINDOWS
	wchar_t buffer[MAX_PATH * 2 + 1];

	if (SUCCEEDED(SHGetFolderPath(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, buffer))) {
		CLocalPath tmp(buffer);
		if (!tmp.empty()) {
			tmp.AddSegment(L"FileZilla");
		}
		ret = tmp;
	}
	else {
		// Fall back to directory where the executable is
		DWORD c = GetModuleFileName(0, buffer, MAX_PATH * 2);
		if (c && c < MAX_PATH * 2) {
			std::wstring tmp;
			ret.SetPath(buffer, &tmp);
		}
	}
#else
	std::wstring cfg = TryDirectory(GetEnv(_T("XDG_CONFIG_HOME")), _T("filezilla/"), true);
	if (cfg.empty()) {
		cfg = TryDirectory(wxGetHomeDir(), _T(".config/filezilla/"), true);
	}
	if (cfg.empty()) {
		cfg = TryDirectory(wxGetHomeDir(), _T(".filezilla/"), true);
	}
	if (cfg.empty()) {
		cfg = TryDirectory(GetEnv(_T("XDG_CONFIG_HOME")), _T("filezilla/"), false);
	}
	if (cfg.empty()) {
		cfg = TryDirectory(wxGetHomeDir(), _T(".config/filezilla/"), false);
	}
	if (cfg.empty()) {
		cfg = TryDirectory(wxGetHomeDir(), _T(".filezilla/"), false);
	}
	ret.SetPath(cfg);
#endif
	return ret;
}
开发者ID:zedfoxus,项目名称:filezilla-client,代码行数:43,代码来源:Options.cpp


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