/** Cuts the standard data path from the 'path' argument. If path does not start with the standard data path, then do nothing. Always returns a path converted to "/". */ QString PathUtils::RemoveDataPath(QString path) { // Depending on the platform, we might get either "/" or "\" // so we need to go to the standard ("/") QString goodPath = QDir::fromNativeSeparators(path); if (goodPath.startsWith(GetDataPath())) { int i = goodPath.length()- GetDataPath().length(); return QString("%%DATAPATH%%") + goodPath.right(i); } else return goodPath; }
CFilePathMgr::CFilePathMgr() { m_sTemplateDatabasePath = GetAppPath(); em_utility::mci::confirm_dir(m_sTemplateDatabasePath,_T('/')); m_sDatabasePath = GetDataPath()+ _T("db/"); em_utility::mci::confirm_dir(m_sDatabasePath,_T('/')); //m_sExpressionPath = GetAppPath()+ _T("gif/"); //em_utility::misc::confirm_dir(m_sExpressionPath,_T('/')); m_sDefaultCachePath = GetDataPath()+_T("cache/"); em_utility::mci::confirm_dir(m_sDefaultCachePath,_T('/')); m_sLogPath = GetDataPath() + _T("log/"); em_utility::mci::confirm_dir(m_sLogPath,_T('/')); }
bool Feed::Download(int index) { if (category != FEED_CATEGORY_LINK) return false; DWORD dwMode = HTTP_Feed_Download; if (index == -1) { for (size_t i = 0; i < items.size(); i++) { if (items[i].state == FEEDITEM_SELECTED) { dwMode = HTTP_Feed_DownloadAll; index = i; break; } } } if (index < 0 || index > static_cast<int>(items.size())) return false; download_index = index; MainDialog.ChangeStatus(L"Downloading \"" + items[index].title + L"\"..."); TorrentDialog.EnableInput(false); wstring file = items[index].title + L".torrent"; ValidateFileName(file); file = GetDataPath() + file; return client.Get(win32::Url(items[index].link), file, dwMode, reinterpret_cast<LPARAM>(this)); }
bfs::path GetTunnelsConfigFile() { bfs::path pathTunnelsConfigFile( i2p::util::config::var_map["tunnelsconf"].as<std::string>()); if (!pathTunnelsConfigFile.is_complete()) pathTunnelsConfigFile = GetDataPath() / pathTunnelsConfigFile; return pathTunnelsConfigFile; }
boost::filesystem::path GetConfigFile() { boost::filesystem::path kovri_conf( i2p::util::config::var_map["kovriconf"].as<std::string>()); if (!kovri_conf.is_complete()) kovri_conf = GetDataPath() / kovri_conf; return kovri_conf; }
boost::filesystem::path GetTunnelsConfigFile() { boost::filesystem::path tunnels_conf( i2p::util::config::var_map["tunnelsconf"].as<std::string>()); if (!tunnels_conf.is_complete()) tunnels_conf = GetDataPath() / tunnels_conf; return tunnels_conf; }
void Save() { for (auto &p : mAlgoEmlMap) { auto &eml = p.second; if (eml.IsModefy()) { try { msgpack::sbuffer sbuf; msgpack::pack(sbuf, eml); uint8_t kernel_w, kernel_h, pad_w, pad_h, stride_w, stride_h; uint16_t batch_size; eml.GetLayerData(kernel_w, kernel_h, pad_w, pad_h, stride_w, stride_h, batch_size); const std::string SavePath = GetDataPath(kernel_w, kernel_h, pad_w, pad_h, stride_w, stride_h, batch_size); FILE *fp = fopen(SavePath.c_str(), "wb"); if (fp) { fwrite(sbuf.data(), 1, sbuf.size(), fp); fclose(fp); eml.Saved(); } } catch(...) {} } } }
void DFSpells::Save() { std::ofstream fout( GetDataPath("%s/world/spellsTEST"), std::ios::binary ); fout << "#\n" "# key: \n" "# S:school, provider deity, skill, resistSkill,r,g,b,symbol\n" "# G:deity description (multiple lines)\n" "# L:Message from deity when donation is too low\n" "# N:Message from deity when donation is too low\n" "# H:Message from deity when donation is too low\n" "# P:spell, symbol, level, mana, exp, failure rate, action, distance, single/group target, speed, effect, CLIP, icontileX, icontileY, F|H[ ,pre-requisite ]\n" "# W:sound\n" "# D:notes\n" "#\n" "# Symbol (for spells) is used to modify item name if item contains the spell. (e.g.: staffs, rings, etc.)\n" "#\n" "# CLIP=C-creature target, L-location target, I-item target, P-target is the party\n" "# F|H=F-Friendly, H-Hostile (it's how monsters use spells)\n" "# pre-requisite:\n" "# for Friendly spells: (reverse for hostile: high hp, etc.)\n" "# \thp - low hp\n" "#\tac - low ac\n" "#\tcursed, etc. - having bad state-mod\n" "# \tblessed, etc. - not having good state-mod\n" "\n" "# \n" "# stat-mods:\n" "# \n" "# good:\n" "# \tblessed=0, \n" "# \tempowered, \n" "# \tenraged, \n" "# \tac_protected, \n" "# \tmagic_protected,\n" "# \tinvisible,\n" "# \n" "# bad:\n" "# \tdrunk, \n" "# \tpoisoned, \n" "# \tcursed, \n" "# \tpossessed, \n" "# \tblinded, \n" "# \tcharmed, \n" "# \tdead,\n" "# \n" "# neutral:\n" "# \toverloaded,\n" "# \tleveled\n" "#\n\n\n"; std::vector<School*>::iterator itr; for ( itr = data.begin(); itr != data.end(); itr++ ) { SaveSchool(fout, *itr); } fout.close(); }
void DFCreatures::Save() { std::ofstream fout( GetDataPath("%s/world/creaturesTEST"), std::ios::binary ); fout << "# Creatures\n" << "# \n" << "# Key: (the old-way)\n" << "# M:monster\n" << "# name[,(descriptive type for monsters | portrait for npcs)]\n" << "# md2 model, skin, level,hp,mp,natural armor,rareness,speed[,scale(overrides shapes.txt's scale),npc[,startX,startY]]\n" << "# I:backpack (1 line per item ref. by name from items.txt)\n" << "# S:spell\n" << "# P:skill_name,percentage (skill level; used mainly for magic resistance)\n" << "#\n" << "# Notes: \n" << "# hp,mp are multiplied by the level when the monster is created (natural armor isn't)\n" << "# rareness=1-10 where 1 is most and 10 is least rare (for given level)\n" << "# speed=1-10 where 1 is the fastest and 10 is the slowest\n" << "# descriptiveType is only needed once per model\n" << "#\n" << "# Magic schools:\n" << "# RESIST_NATURE_MAGIC,\n" << "# RESIST_AWARENESS_MAGIC,\n" << "# RESIST_LIFE_AND_DEATH_MAGIC,\n" << "# RESIST_HISTORY_MAGIC,\n" << "# RESIST_DECEIT_MAGIC,\n" << "# RESIST_CONFRONTATION_MAGIC\n\n"; std::vector <Creature*>::iterator itr = data.begin(); for ( ; itr != data.end(); itr++ ) { fout << "M:" << (*itr)->name; if ( (*itr)->portrait != "" ) fout << "," << (*itr)->portrait; fout << "\nM:" << (*itr)->md2 << "," << (*itr)->skin << "," << (*itr)->level << "," << (*itr)->hp << "," << (*itr)->mp << "," << (*itr)->armor << "," << (*itr)->rareness << "," << (*itr)->speed; if ( (*itr)->scale != "" ) fout << "," << (*itr)->scale; if ( (*itr)->npc != "" ) fout << "," << (*itr)->npc; if ( (*itr)->npcStartX != "-1" ) fout << "," << (*itr)->npcStartX << "," << (*itr)->npcStartY; std::vector<std::string>::iterator strVecItr; for ( strVecItr = (*itr)->backpack.begin(); strVecItr != (*itr)->backpack.end(); strVecItr++ ) fout << "\nI:" << *strVecItr; for ( strVecItr = (*itr)->spells.begin(); strVecItr != (*itr)->spells.end(); strVecItr++ ) fout << "\nS:" << *strVecItr; std::map<std::string,std::string>::iterator strMapItr; for ( strMapItr = (*itr)->skills.begin(); strMapItr != (*itr)->skills.end(); strMapItr++ ) fout << "\nP:" << strMapItr->first << "," << strMapItr->second; fout << "\n\n"; } fout.close(); }
std::string PATHMANAGER::GetCarPath(const std::string & carname) const { // Check writeable car path first (check for presence of .car files). if (FileExists(GetWriteableDataPath() + "/" + GetCarsDir() + "/" + carname + "/" + carname + ".car")) return GetWriteableDataPath() + "/" + GetCarsDir() + "/" + carname; else return GetDataPath()+"/"+GetCarsDir()+"/"+carname; }
/** Inserts the data path (only if the path starts with %%DATAPATH%%) Returns a "/" or "\" separated path depending on platform conventions. */ QString PathUtils::InsertDataPath(QString path) { if (path.startsWith(QString("%%DATAPATH%%"))) { QString newPath = GetDataPath(); newPath += path.right(path.length() - 12); return QDir::toNativeSeparators(newPath); } return QDir::toNativeSeparators(path); }
QString ResourcesManageHelper::GetResourceRootDirectory() { QString projectPath = GetProjectPath(); if (projectPath.isNull() || projectPath.isEmpty()) { return QString(); } return GetDataPath(projectPath); }
bool Feed::Load() { // Initialize wstring file = GetDataPath() + L"feed.xml"; items.clear(); // Load XML file xml_document doc; xml_parse_result result = doc.load_file(file.c_str()); if (result.status != status_ok) { return false; } // Read channel information xml_node channel = doc.child(L"rss").child(L"channel"); title = XML_ReadStrValue(channel, L"title"); link = XML_ReadStrValue(channel, L"link"); description = XML_ReadStrValue(channel, L"description"); // Read items for (xml_node item = channel.child(L"item"); item; item = item.next_sibling(L"item")) { // Read data items.resize(items.size() + 1); items.back().index = items.size() - 1; items.back().category = XML_ReadStrValue(item, L"category"); items.back().title = XML_ReadStrValue(item, L"title"); items.back().link = XML_ReadStrValue(item, L"link"); items.back().description = XML_ReadStrValue(item, L"description"); // Remove if title or link is empty if (category == FEED_CATEGORY_LINK) { if (items.back().title.empty() || items.back().link.empty()) { items.pop_back(); continue; } } // Clean up title DecodeHtmlEntities(items.back().title); Replace(items.back().title, L"\\'", L"'"); // Clean up description Replace(items.back().description, L"<br/>", L"\n"); Replace(items.back().description, L"<br />", L"\n"); StripHtmlTags(items.back().description); DecodeHtmlEntities(items.back().description); Trim(items.back().description, L" \n"); Aggregator.ParseDescription(items.back(), link); Replace(items.back().description, L"\n", L" | "); // Get download link if (InStr(items.back().link, L"nyaatorrents", 0, true) > -1) { Replace(items.back().link, L"torrentinfo", L"download"); } } return true; }
std::string GetFullPath( const std::string& filename) { std::string full_path = GetDataPath().string(); #ifdef _WIN32 full_path.append("\\"); #else full_path.append("/"); #endif full_path.append(filename); return full_path; }
WebKitDatabases::WebKitDatabases() : origin(GetApplicationSecurityOrigin()), originPath(GetDataPath(origin)), session(0) { std::string dbPath = FileUtils::Join(GetDataPath().c_str(), "Databases.db", NULL); GetLogger()->Debug("DB Path = %s", dbPath.c_str()); this->session = new Session("SQLite", dbPath); Statement select(*this->session); GetLogger()->Debug("Creating table Origins"); select << "CREATE TABLE IF NOT EXISTS Origins (origin TEXT UNIQUE ON " "CONFLICT REPLACE, quota INTEGER NOT NULL ON CONFLICT FAIL)", now; Statement select2(*this->session); GetLogger()->Debug("Creating table Databases"); select2 << "CREATE TABLE IF NOT EXISTS Databases (guid INTEGER PRIMARY KEY " "AUTOINCREMENT, origin TEXT, name TEXT, displayName TEXT, estimatedSize " "INTEGER, path TEXT)", now; }
} void subPageSpells::UpdateIcon() { wxImage image(std2wx(GetDataPath("%s/textures/spells.bmp"))); wxBitmap bitmap(image); int icon_x = iconXScroll->GetThumbPosition(); int icon_y = iconYScroll->GetThumbPosition(); if ( icon_x == 0 ) icon_x = 1; if ( icon_y == 0 ) icon_y = 1; wxBitmap icon = bitmap.GetSubBitmap( wxRect(32*(icon_x-1),32*(icon_y-1),32,32) ); wxClientDC dc(page); dc.DrawBitmap(icon, 35,230, false);
void DFSkills::Save() { std::ofstream fout( GetDataPath("%s/world/skillsTEST"), std::ios::binary); /** * Possible improvement: set out skills in class sections as already done in skills.txt * To do this class data will probably need to be saved, or comments read to determine what * section a skill belongs in * (Probably the latter) */ fout << "# Special skills\n" << "# Key:\n" << "# S:name,squirrel name,type[,event],icon_x,icon_y\n" << "# where:\n" << "# squirrel name is the postfix part of a two Squirrel functions:\n" << "# prereq<squirrel name> is called for the prerequisite it should return a true/false value\n" << "# action<squirrel name> is called to performt the action,when activating the skill\n" << "# icon tile x,y are from spells.bmp\n" << "# D:Description of skill (multiple lines)\n" << "#\n" << "# type is: (M-manual,A-automatic)\n" << "# event is: (A-armor)\n" << "#\n" << "# The prereq function can be slow-ish, but the action should execute\n" << "# fast.\n" << "#\n" << "# TODO: add prereq special skills here to create a rough tree of what\n" << "# sages show. This also helps with not running too many prereq functions.\n\n"; std::vector <std::string> lines; for ( std::vector<SpecialSkill*>::iterator itr = data.begin(); itr != data.end(); itr++ ) { fout << "S:" << (*itr)->name << ',' << (*itr)->squirrelName << ',' << (*itr)->type << ','; if ( (*itr)->type == "A" ) fout << (*itr)->event << ','; fout << (*itr)->icon_x << ',' << (*itr)->icon_y; SplitLine((*itr)->description,lines); for ( unsigned int i = 0; i < lines.size(); i++ ) fout << "\nD:" << lines[i]; fout << "\n\n"; } fout.close(); }
bool Feed::Check(const wstring& source, bool automatic) { // Reset ticker before checking the source so we don't fall into a loop ticker = 0; if (source.empty()) return false; link = source; switch (category) { case FEED_CATEGORY_LINK: // Disable torrent dialog input TorrentDialog.EnableInput(false); break; } return client.Get(win32::Url(link), GetDataPath() + L"feed.xml", automatic ? HTTP_Feed_CheckAuto : HTTP_Feed_Check, reinterpret_cast<LPARAM>(this)); }
HICON Feed::GetIcon() { if (link.empty()) return NULL; if (icon_) { DestroyIcon(icon_); icon_ = nullptr; } wstring path = GetDataPath() + L"favicon.ico"; if (FileExists(path)) { icon_ = GdiPlus.LoadIcon(path); return icon_; } else { win32::Url url(link + L"/favicon.ico"); client.Get(url, path, HTTP_Feed_DownloadIcon, reinterpret_cast<LPARAM>(this)); return NULL; } }
std::wstring GetPath(PathType type) { static const std::wstring data_path = GetDataPath(); switch (type) { default: case kPathData: return data_path; case kPathDatabase: return data_path + L"db\\"; case kPathDatabaseAnime: return data_path + L"db\\anime.xml"; case kPathDatabaseAnimeRelations: return data_path + L"db\\anime_relations.txt"; case kPathDatabaseImage: return data_path + L"db\\image\\"; case kPathDatabaseSeason: return data_path + L"db\\season\\"; case kPathFeed: return data_path + L"feed\\"; case kPathFeedHistory: return data_path + L"feed\\history.xml"; case kPathMedia: return data_path + L"media.xml"; case kPathSettings: return data_path + L"settings.xml"; case kPathTest: return data_path + L"test\\"; case kPathTestRecognition: return data_path + L"test\\recognition.xml"; case kPathTheme: return data_path + L"theme\\"; case kPathThemeCurrent: return data_path + L"theme\\" + Settings[kApp_Interface_Theme] + L"\\theme.xml"; case kPathUser: return data_path + L"user\\"; case kPathUserHistory: return data_path + L"user\\" + GetUserDirectoryName() + L"\\history.xml"; case kPathUserLibrary: return data_path + L"user\\" + GetUserDirectoryName() + L"\\anime.xml"; } }
std::wstring GetPath(Path path) { static const std::wstring data_path = GetDataPath(); switch (path) { default: case Path::Data: return data_path; case Path::Database: return data_path + L"db\\"; case Path::DatabaseAnime: return data_path + L"db\\anime.xml"; case Path::DatabaseAnimeRelations: return data_path + L"db\\anime-relations.txt"; case Path::DatabaseImage: return data_path + L"db\\image\\"; case Path::DatabaseSeason: return data_path + L"db\\season\\"; case Path::Feed: return data_path + L"feed\\"; case Path::FeedHistory: return data_path + L"feed\\history.xml"; case Path::Media: return data_path + L"players.anisthesia"; case Path::Settings: return data_path + L"settings.xml"; case Path::Test: return data_path + L"test\\"; case Path::TestRecognition: return data_path + L"test\\recognition.xml"; case Path::Theme: return data_path + L"theme\\"; case Path::ThemeCurrent: return data_path + L"theme\\" + Settings[kApp_Interface_Theme] + L"\\theme.xml"; case Path::User: return data_path + L"user\\"; case Path::UserHistory: return data_path + L"user\\" + GetUserDirectoryName() + L"\\history.xml"; case Path::UserLibrary: return data_path + L"user\\" + GetUserDirectoryName() + L"\\anime.xml"; } }
bool Load(uint8_t kernel_w, uint8_t kernel_h, uint8_t pad_w, uint8_t pad_h, uint8_t stride_w, uint8_t stride_h, uint16_t batch_size) { const std::string SavePath = GetDataPath(kernel_w, kernel_h, pad_w, pad_h, stride_w, stride_h, batch_size); std::vector<char> sbuf; FILE *fp = fopen(SavePath.c_str(), "rb"); if (!fp) return false; fseek(fp, 0, SEEK_END); const auto size = ftell(fp); fseek(fp, 0, SEEK_SET); sbuf.resize(size); if (fread(sbuf.data(), 1, sbuf.size(), fp) != sbuf.size()) { fclose(fp); return false; } fclose(fp); try { CcuDNNAlgorithmElement elm; msgpack::unpack(sbuf.data(), sbuf.size()).get().convert(elm); sbuf.clear(); const uint64_t key = InfoToKey(kernel_w, kernel_h, pad_w, pad_h, stride_w, stride_h, batch_size); mAlgoEmlMap[key] = std::move(elm); } catch (...) { boost::filesystem::remove(SavePath); } return true; }
void PATHMANAGER::Init(std::ostream & info_output, std::ostream & error_output) { typedef std::vector<fs::path> Paths; // Set Ogre plugins dir { ogre_plugin_dir = ""; char *plugindir = getenv("OGRE_PLUGIN_DIR"); if (plugindir) { ogre_plugin_dir = plugindir; #ifndef _WIN32 } else if (fs::exists(fs::path(OGRE_PLUGIN_DIR) / "RenderSystem_GL.so")) { ogre_plugin_dir = OGRE_PLUGIN_DIR; #endif } else { #ifdef _WIN32 ogre_plugin_dir = "."; #else Paths dirs; #if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(_M_X64) dirs.push_back("/usr/local/lib64"); dirs.push_back("/usr/lib64"); #else dirs.push_back("/usr/local/lib32"); dirs.push_back("/usr/lib32"); #endif dirs.push_back("/usr/local"); dirs.push_back("/usr/lib"); // Loop through the paths and pick the first one that contain a plugin for (Paths::const_iterator p = dirs.begin(); p != dirs.end(); ++p) { if (fs::exists(*p / "OGRE/RenderSystem_GL.so")) { ogre_plugin_dir = (*p / "OGRE").string(); break; } else if (fs::exists(*p / "ogre/RenderSystem_GL.so")) { ogre_plugin_dir = (*p / "ogre").string(); break; } } #endif } } fs::path shortDir = "stuntrally"; // Figure out the user's home directory { home_dir = ""; #ifndef _WIN32 // POSIX char *homedir = getenv("HOME"); if (homedir == NULL) { home_dir = "/home/"; homedir = getenv("USER"); if (homedir == NULL) { homedir = getenv("USERNAME"); if (homedir == NULL) { error_output << "Could not find user's home directory!" << std::endl; home_dir = "/tmp/"; } } } #else // Windows char *homedir = getenv("USERPROFILE"); if (homedir == NULL) homedir = "data"; // WIN 9x/Me #endif home_dir += homedir; } // Find user's config dir #ifndef _WIN32 // POSIX { char const* conf = getenv("XDG_CONFIG_HOME"); if (conf) user_config_dir = (fs::path(conf) / "stuntrally").string(); else user_config_dir = (fs::path(home_dir) / ".config" / "stuntrally").string(); } #else // Windows { // Open AppData directory std::string str; ITEMIDLIST* pidl; char AppDir[MAX_PATH]; HRESULT hRes = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE , &pidl); if (hRes == NOERROR) { SHGetPathFromIDList(pidl, AppDir); int i; for (i = 0; AppDir[i] != '\0'; i++) { if (AppDir[i] == '\\') str += '/'; else str += AppDir[i]; } user_config_dir = (fs::path(str) / "stuntrally").string(); } } #endif // Create user's config dir CreateDir(user_config_dir, error_output); // Find user's data dir (for additional data) #ifdef _WIN32 user_data_dir = user_config_dir; // APPDATA/stuntrally #else { fs::path shareDir = SHARED_DATA_DIR; char const* xdg_data_home = getenv("XDG_DATA_HOME"); user_data_dir = (xdg_data_home ? xdg_data_home / shortDir : fs::path(home_dir) / ".local" / shareDir).string(); } #endif // Create user's data dir and its children CreateDir(user_data_dir, error_output); CreateDir(GetTrackRecordsPath(), error_output); CreateDir(GetScreenShotDir(), error_output); CreateDir(GetTrackPathUser(), error_output); // user tracks CreateDir(GetTrackPathUser()+"/_previews", error_output); CreateDir(GetReplayPath(), error_output); CreateDir(GetGhostsPath(), error_output); // Find game data dir and defaults config dir char *datadir = getenv("STUNTRALLY_DATA_ROOT"); if (datadir) game_data_dir = std::string(datadir); else { fs::path shareDir = SHARED_DATA_DIR; Paths dirs; // Adding users data dir // TODO: Disabled for now until this is handled properly //dirs.push_back(user_data_dir); // Adding relative path from installed executable dirs.push_back(execname().parent_path().parent_path() / shareDir); // Adding relative path for running from sources dirs.push_back(execname().parent_path().parent_path() / "data"); dirs.push_back(execname().parent_path().parent_path()); dirs.push_back(execname().parent_path() / "data"); dirs.push_back(execname().parent_path()); #ifndef _WIN32 // Adding XDG_DATA_DIRS { char const* xdg_data_dirs = getenv("XDG_DATA_DIRS"); std::istringstream iss(xdg_data_dirs ? xdg_data_dirs : "/usr/local/share/:/usr/share/"); for (std::string p; std::getline(iss, p, ':'); dirs.push_back(p / shortDir)) {} } #endif // TODO: Adding path from config file // Loop through the paths and pick the first one that contain some data for (Paths::const_iterator p = dirs.begin(); p != dirs.end(); ++p) { // Data dir if (fs::exists(*p / "hud")) game_data_dir = p->string(); // Config dir if (fs::exists(*p / "config")) game_config_dir = (*p / "config").string(); // Check if both are found if (!game_data_dir.empty() && !game_config_dir.empty()) break; } } // Find cache dir #ifdef _WIN32 cache_dir = user_config_dir + "/cache"; // APPDATA/stuntrally/cache #else char const* xdg_cache_home = getenv("XDG_CACHE_HOME"); cache_dir = (xdg_cache_home ? xdg_cache_home / shortDir : fs::path(home_dir) / ".cache" / shortDir).string(); #endif // Create cache dir CreateDir(cache_dir, error_output); CreateDir(GetShaderCacheDir(), error_output); // Print diagnostic info std::stringstream out; out << "--- Directories: ---" << ogre_plugin_dir << std::endl; out << "Ogre plugin: " << ogre_plugin_dir << std::endl; out << "Home: " << home_dir << std::endl; out << "Default cfg: " << GetGameConfigDir() << std::endl; out << "User cfg: " << GetUserConfigDir() << std::endl; out << "Data: " << GetDataPath() << std::endl; out << "User data: " << GetUserDataDir() << std::endl; out << "Cache: " << GetCacheDir() << std::endl; out << "Shader cache: " << GetShaderCacheDir() << std::endl; out << "Log: " << GetLogDir() << std::endl; info_output << out.str(); }
boost::filesystem::path GetSSLCertsPath() { return GetDataPath() / "certificates" / "ssl"; }
std::string PATHMANAGER::GetUpdateManagerFileBase() const { return GetDataPath() + "/settings/updates.config"; }
std::string PATHMANAGER::GetReadOnlyCarsPath() const { return GetDataPath()+"/"+GetCarsDir(); }
std::string PATHMANAGER::GetReadOnlyTracksPath() const { return GetDataPath()+"/"+GetTracksDir(); }
bfs::path GetSSLCertsPath() { return GetDataPath() / "certificates" / "ssl"; }
bfs::path GetSU3CertsPath() { return GetDataPath() / "certificates" / "su3"; }
bool vmsFirefoxUtil::GetProfilesPathes(FU_STRINGLIST &v, int &nDefaultProfile) { try { char szPath [MY_MAX_PATH]; GetDataPath (szPath); char szProfilesIni [MY_MAX_PATH]; lstrcpy (szProfilesIni, szPath); lstrcat (szProfilesIni, "profiles.ini"); if (GetFileAttributes (szProfilesIni) != DWORD (-1)) { nDefaultProfile = -1; for (int i = 0;; i++) { char sz [100], szPP [MY_MAX_PATH] = ""; sprintf (sz, "Profile%d", i); GetPrivateProfileString (sz, "Path", "", szPP, sizeof (szPP), szProfilesIni); if (*szPP == 0) break; LPSTR psz = szPP; while (*psz) { if (*psz == '/') *psz = '\\'; psz++; } if (szPP [1] == ':') { v.add (szPP); } else { char sz [MY_MAX_PATH]; lstrcpy (sz, szPath); lstrcat (sz, szPP); v.add (sz); } if (nDefaultProfile == -1 && GetPrivateProfileInt (sz, "Default", 0, szProfilesIni)) nDefaultProfile = i; } } if (v.size () == 0) { char szProfiles [MY_MAX_PATH]; vmsFirefoxUtil::GetProfilesPath (szProfiles); lstrcat (szProfiles, "*"); WIN32_FIND_DATA wfd; HANDLE hFind = FindFirstFile (szProfiles, &wfd); if (hFind == INVALID_HANDLE_VALUE) return false; do { if (0 == lstrcmp (wfd.cFileName, ".") || 0 == lstrcmp (wfd.cFileName, "..")) continue; char sz [MY_MAX_PATH]; lstrcpy (sz, szPath); lstrcat (sz, wfd.cFileName); DWORD dw = GetFileAttributes (sz); if (dw != DWORD (-1) && (dw & FILE_ATTRIBUTE_DIRECTORY)) { char sz2 [MY_MAX_PATH]; lstrcpy (sz2, sz); lstrcat (sz2, "\\extensions\\"); DWORD dw = GetFileAttributes (sz2); if (dw != DWORD (-1) && (dw & FILE_ATTRIBUTE_DIRECTORY)) v.add (sz); } } while (FindNextFile (hFind, &wfd)); FindClose (hFind); } return true; }catch (...) {return false;} }