void wxSTEditorOptions::LoadFileConfig( wxConfigBase &config) { const wxString oldpath = config.GetPath(); wxFileHistory *fileHistory = GetFileHistory(); if (!fileHistory) return; wxString configPath = FixConfigPath(GetConfigPath(STE_OPTION_CFGPATH_FILEHISTORY), false); wxString value, key = configPath+wxT("/LastDir"); if (config.Read(key, &value) && wxDirExists(value)) SetDefaultFilePath(value); config.SetPath(configPath); fileHistory->Load(config); config.SetPath(oldpath); }
void wxSTEditorOptions::LoadFileConfig( wxConfigBase &config) { wxFileHistory *fileHistory = GetFileHistory(); if (!fileHistory) return; wxString configPath = FixConfigPath(GetConfigPath(STE_OPTION_CFGPATH_FILEHISTORY), false); wxString value, key = configPath+wxT("/LastDir"); if (config.Read(key, &value) && wxDirExists(value)) SetDefaultFilePath(value); int n = 1; key = configPath + wxString::Format(wxT("/file%d"), n); while ((int(n-1) < fileHistory->GetMaxFiles()) && config.Read(key, &value) && (!value.IsEmpty())) { //value.Trim(false).Trim(true); if (!value.IsEmpty() && wxFileExists(value)) fileHistory->AddFileToHistory(value); key = configPath + wxString::Format(wxT("/file%d"), ++n); value.Clear(); } }
int CPROC CHANGEDIR( PSENTIENT ps, PTEXT parameters ) { PTEXT pDir, pDir1; pDir1 = MacroDuplicateEx( ps, parameters, TRUE, TRUE ); if( pDir1 ) pDir = BuildLine( pDir1 ); else return FALSE; LineRelease( pDir1 ); if( SetCurrentPath( GetText( pDir ) ) ) { if( ps->CurrentMacro ) ps->CurrentMacro->state.flags.bSuccess = TRUE; else { DECLTEXT( msg, WIDE("Changed directory successfully.") ); { TEXTCHAR buf[257]; GetCurrentPath( buf, sizeof( buf ) ); SetDefaultFilePath( buf ); } EnqueLink( &ps->Command->Output, &msg ); } } else { if( !ps->CurrentMacro ) { DECLTEXT( msg, WIDE("Failed to change directory.") ); EnqueLink( &ps->Command->Output, &msg ); } } LineRelease( pDir ); return FALSE; }