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); } } }
// 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; }
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; } }
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(); } }
/* 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; }
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); } }
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); }
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(); } }
wxString wxGetHomeDir() { wxString home; wxGetHomeDir(&home); return home; }
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); }
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()); }
wxString wxGetUserHome(const wxString& user) { wxString home; if (user.empty() || user == wxGetUserId()) wxGetHomeDir(&home); return home; }
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; } }
/** * ヘルプを押した際のイベント */ 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); }
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; }
int main(int argc,char **argv) { wxPuts(wxGetHomeDir()); wxPuts(wxGetOsDescription()); wxPuts(wxGetUserName()); wxPuts(wxGetFullHostName()); long mem = wxGetFreeMemory().ToLong(); wxPrintf(wxT("Memory: %d\n"),mem); return 0; }
void frmReport::OnBrowseStylesheet(wxCommandEvent &ev) { if (rbHtml->GetValue()) { wxString def = txtHtmlStylesheet->GetValue(); if (!wxFile::Exists(def)) def.Empty(); #ifdef __WXMSW__ wxFileDialog file(this, _("Select stylesheet filename"), wxGetHomeDir(), def, _("HTML Stylesheet files (*.css)|*.css|All files (*.*)|*.*"), wxFD_OPEN); #else wxFileDialog file(this, _("Select stylesheet filename"), wxGetHomeDir(), def, _("HTML Stylesheet files (*.css)|*.css|All files (*)|*"), wxFD_OPEN); #endif if (file.ShowModal() == wxID_OK) { txtHtmlStylesheet->SetValue(file.GetPath()); OnChange(ev); } } else { wxString def = txtXmlStylesheet->GetValue(); if (!wxFile::Exists(def)) def.Empty(); #ifdef __WXMSW__ wxFileDialog file(this, _("Select stylesheet filename"), wxGetHomeDir(), def, _("XML Stylesheet files (*.xsl)|*.xsl|All files (*.*)|*.*"), wxFD_OPEN); #else wxFileDialog file(this, _("Select stylesheet filename"), wxGetHomeDir(), def, _("XML Stylesheet files (*.xsl)|*.xsl|All files (*)|*"), wxFD_OPEN); #endif if (file.ShowModal() == wxID_OK) { txtXmlStylesheet->SetValue(file.GetPath()); OnChange(ev); } } }
// Constructor palm_installer::palm_installer() { m_number_of_users = 0; // Set the m_palm_desktop_path to where it is on a MacOSX machine. m_palm_desktop_path = wxGetHomeDir() + "/Documents/Palm/Users"; wxLogDebug( "Directory to look for Palm Users dat file is" + m_palm_desktop_path ); // All set, so now read the "Palm Users" file in the OSX's user's home directory // (this is the equivalent to users.dat equivalent on MSW). load_user_data(); }
int t04() { wxPuts(wxGetHomeDir()); wxPuts(wxGetOsDescription()); wxPuts(wxGetUserName()); wxPuts(wxGetFullHostName()); wxMemorySize mem = wxGetFreeMemory(); wxPrintf(wxT("Memory: %s\n"), mem.ToString()); return EXIT_SUCCESS; }
void MyFrame::DoDirChoose(int style) { // pass some initial dir to wxDirDialog wxString dirHome; wxGetHomeDir(&dirHome); wxDirDialog dialog(this, _T("Testing directory picker"), dirHome, style); if (dialog.ShowModal() == wxID_OK) { wxLogMessage(_T("Selected path: %s"), dialog.GetPath().c_str()); } }
wxArrayString LadspaEffectsModule::GetSearchPaths() { wxArrayString pathList; wxArrayString files; wxString pathVar; // Check for the LADSPA_PATH environment variable pathVar = wxString::FromUTF8(getenv("LADSPA_PATH")); if (!pathVar.empty()) { wxStringTokenizer tok(pathVar); while (tok.HasMoreTokens()) { pathList.Add(tok.GetNextToken()); } } #if defined(__WXMAC__) #define LADSPAPATH wxT("/Library/Audio/Plug-Ins/LADSPA") // Look in ~/Library/Audio/Plug-Ins/LADSPA and /Library/Audio/Plug-Ins/LADSPA pathList.Add(wxGetHomeDir() + wxFILE_SEP_PATH + LADSPAPATH); pathList.Add(LADSPAPATH); #elif defined(__WXMSW__) // No special paths...probably should look in %CommonProgramFiles%\LADSPA #else pathList.Add(wxGetHomeDir() + wxFILE_SEP_PATH + wxT(".ladspa")); pathList.Add(wxT("/usr/local/lib/ladspa")); pathList.Add(wxT("/usr/lib/ladspa")); pathList.Add(wxT(LIBDIR) wxT("/ladspa")); #endif return pathList; }
void InfoPanel::OnSaveBannerImage(wxCommandEvent& WXUNUSED(event)) { wxFileDialog dialog(this, _("Save as..."), wxGetHomeDir(), wxString::Format("%s.png", m_game_id->GetValue()), wxALL_FILES_PATTERN, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (dialog.ShowModal() == wxID_OK) { m_game_list_item.GetBannerImage().SaveFile(dialog.GetPath()); } Raise(); }
void InteractiveOutputTestCase::TestUserInfo() { #ifdef TEST_INFO_FUNCTIONS wxPuts(wxT("*** Testing user info functions ***\n")); wxPrintf(wxT("User id is:\t%s\n"), wxGetUserId().c_str()); wxPrintf(wxT("User name is:\t%s\n"), wxGetUserName().c_str()); wxPrintf(wxT("Home dir is:\t%s\n"), wxGetHomeDir().c_str()); wxPrintf(wxT("Email address:\t%s\n"), wxGetEmailAddress().c_str()); wxPuts(wxEmptyString); #endif // TEST_INFO_FUNCTIONS }
// -------------------------------------------------------------------------------- // void guImportFiles::OnAddFilesClicked( wxCommandEvent &event ) { wxFileDialog * FileDialog = new wxFileDialog( this, _( "Select files" ), wxGetHomeDir(), wxEmptyString, wxString( _( "Audio files" ) ) + wxT( "|*.mp3;*.ogg;*.oga;*.flac;*.mp4;*.m4a;*.m4b;*.m4p;*.aac;*.wma;*.asf;*.ape;*.wav;*.aif;*.wv;*.tta;*.mpc|" ) + wxString( _( "mp3 files" ) ) + wxT( " (*.mp3)|*.mp3|" ) + wxString( _( "ogg files" ) ) + wxT( " (*.ogg;*.oga)|*.ogg;*.oga|" ) + wxString( _( "flac files" ) ) + wxT( " (*.flac)|*.flac|" ) + wxString( _( "mp4 files" ) ) + wxT( " (*.mp4;*.m4a)|*.mp4;*.m4a;*.m4b;*.m4p;*.aac|" ) + wxString( _( "wma files" ) ) + wxT( " (*.wma;*.asf)|*.wma;*.asf|" ) + wxString( _( "ape files" ) ) + wxT( " (*.ape)|*.ape|" ) + wxString( _( "waf files" ) ) + wxT( " (*.wav)|*.wav|" ) + wxString( _( "aif files" ) ) + wxT( " (*.aif)|*.aif|" ) + wxString( _( "wv files" ) ) + wxT( " (*.wv)|*.wv|" ) + wxString( _( "tta files" ) ) + wxT( " (*.tta)|*.tta|" ) + wxString( _( "mpc files" ) ) + wxT( " (*.mpc)|*.mpc" ), wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE|wxFD_PREVIEW ); if( FileDialog ) { if( FileDialog->ShowModal() == wxID_OK ) { wxArrayString NewFiles; FileDialog->GetPaths( NewFiles ); int Index; int Count = NewFiles.Count(); for( Index = 0; Index < Count; Index++ ) { wxString NewFile = NewFiles[ Index ]; //guLogMessage( wxT( "Openning file '%s'" ), NewFile.c_str() ); if( wxFileExists( NewFile ) && guIsValidAudioFile( NewFile.Lower() ) ) { guTrack * Track = new guTrack(); if( Track->ReadFromFile( NewFile ) ) { Track->m_Type = guTRACK_TYPE_NOTDB; m_Tracks->Add( Track ); m_FilesListBox->Append( NewFile.AfterLast( wxT( '/' ) ) ); } else { delete Track; } } } UpdateCounters(); CheckButtons(); } FileDialog->Destroy(); } }
// -------------------------------------------------------------------------------- // guEq10Band::~guEq10Band() { guConfig * Config = ( guConfig * ) guConfig::Get(); wxPoint WindowPos = GetPosition(); Config->WriteNum( wxT( "PosX" ), WindowPos.x, wxT( "equalizer" ) ); Config->WriteNum( wxT( "PosY" ), WindowPos.y, wxT( "equalizer" ) ); wxSize WindowSize = GetSize(); Config->WriteNum( wxT( "Width" ), WindowSize.x, wxT( "equalizer" ) ); Config->WriteNum( wxT( "Height" ), WindowSize.y, wxT( "equalizer" ) ); Config->WriteStr( wxT( "LastEqPreset" ), m_BandChanged ? wxT( "" ) : m_PresetComboBox->GetValue(), wxT( "equalizer" ) ); wxFileConfig * EqConfig = new wxFileConfig( wxEmptyString, wxEmptyString, wxGetHomeDir() + wxT( "/.guayadeque/equalizers.conf" ) ); if( EqConfig ) { EqConfig->DeleteGroup( wxT( "Equalizers" ) ); EqConfig->SetPath( wxT( "Equalizers" ) ); int index; int count = m_EQPresets.Count(); for( index = 0; index < count; index++ ) { if( !EqConfig->Write( m_EQPresets[ index ].m_Name, wxString::Format( wxT( "%i,%i,%i,%i,%i,%i,%i,%i,%i,%i" ), m_EQPresets[ index ].m_Sets[ 0 ], m_EQPresets[ index ].m_Sets[ 1 ], m_EQPresets[ index ].m_Sets[ 2 ], m_EQPresets[ index ].m_Sets[ 3 ], m_EQPresets[ index ].m_Sets[ 4 ], m_EQPresets[ index ].m_Sets[ 5 ], m_EQPresets[ index ].m_Sets[ 6 ], m_EQPresets[ index ].m_Sets[ 7 ], m_EQPresets[ index ].m_Sets[ 8 ], m_EQPresets[ index ].m_Sets[ 9 ] ) ) ) guLogError( wxT( "Error writing key %s" ), m_EQPresets[ index ].m_Name.c_str() ); } delete EqConfig; } // m_PresetComboBox->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( guEq10Band::OnPresetSelected ), NULL, this ); m_PresetComboBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( guEq10Band::OnPresetText ), NULL, this ); m_ResetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( guEq10Band::OnResetPreset ), NULL, this ); m_SaveButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( guEq10Band::OnAddPreset ), NULL, this ); m_DelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( guEq10Band::OnDelPreset ), NULL, this ); int Index; for( Index = 0; Index < guEQUALIZER_BAND_COUNT; Index++ ) { m_Bands[ Index ]->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( guEq10Band::OnBandChanged ), NULL, this ); m_Bands[ Index ]->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( guEq10Band::OnUpdateLabel ), NULL, this ); } }
void MyFrame::GenericDirChoose(wxCommandEvent& WXUNUSED(event) ) { // pass some initial dir to wxDirDialog wxString dirHome; wxGetHomeDir(&dirHome); wxGenericDirDialog dialog(this, _T("Testing generic directory picker"), dirHome); if (dialog.ShowModal() == wxID_OK) { wxMessageDialog dialog2(this, dialog.GetPath(), _T("Selected path")); dialog2.ShowModal(); } }
CLocalPath COptions::GetUnadjustedSettingsDir() { wxFileName fn; #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 wxString 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); } fn = wxFileName(cfg, _T("")); #endif return CLocalPath(fn.GetPath()); }
NodesDb::NodesDb() { ms_Instance = this; m_Paths.Add(_T(".")); m_Paths.Add(_T("./df")); #ifdef __UNIX__ m_Paths.Add(wxGetHomeDir() + _T("/.wxrcedit")); #ifdef wxINSTALL_PREFIX m_Paths.Add(wxINSTALL_PREFIX _T("/share/wx/wxrcedit")); #endif #endif Load(); }
// -------------------------------------------------------------------------------- // void guUserRadioProvider::OnRadioExport( wxCommandEvent &event ) { guRadioStations UserStations; m_Db->GetUserRadioStations( &UserStations ); int Index; int Count; if( ( Count = UserStations.Count() ) ) { wxFileDialog * FileDialog = new wxFileDialog( m_RadioPanel, wxT( "Select the output xml filename" ), wxGetHomeDir(), wxT( "RadioStations.xml" ), wxT( "*.xml;*.xml" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( FileDialog ) { if( FileDialog->ShowModal() == wxID_OK ) { wxXmlDocument OutXml; //OutXml.SetRoot( ); wxXmlNode * RootNode = new wxXmlNode( wxXML_ELEMENT_NODE, wxT( "RadioStations" ) ); for( Index = 0; Index < Count; Index++ ) { //guLogMessage( wxT( "Adding %s" ), UserStations[ Index ].m_Name.c_str() ); wxXmlNode * RadioNode = new wxXmlNode( wxXML_ELEMENT_NODE, wxT( "RadioStation" ) ); wxXmlNode * RadioName = new wxXmlNode( wxXML_ELEMENT_NODE, wxT( "Name" ) ); wxXmlNode * RadioNameVal = new wxXmlNode( wxXML_TEXT_NODE, wxT( "Name" ), UserStations[ Index ].m_Name ); RadioName->AddChild( RadioNameVal ); RadioNode->AddChild( RadioName ); wxXmlNode * RadioUrl = new wxXmlNode( wxXML_ELEMENT_NODE, wxT( "Url" ) ); wxXmlNode * RadioUrlVal = new wxXmlNode( wxXML_TEXT_NODE, wxT( "Url" ), UserStations[ Index ].m_Link ); RadioUrl->AddChild( RadioUrlVal ); RadioNode->AddChild( RadioUrl ); RootNode->AddChild( RadioNode ); } OutXml.SetRoot( RootNode ); OutXml.Save( FileDialog->GetPath() ); } FileDialog->Destroy(); } } }
void wxGenericDirCtrl::SetupSections() { wxArrayString paths, names; wxArrayInt icons; size_t n, count = wxGetAvailableDrives(paths, names, icons); #ifdef __WXGTK20__ wxString home = wxGetHomeDir(); AddSection( home, _("Home directory"), 1); home += wxT("/Desktop"); AddSection( home, _("Desktop"), 1); #endif for (n = 0; n < count; n++) AddSection(paths[n], names[n], icons[n]); }