CLIB_API const boost::filesystem::path & GetCompanyFolder(boost::filesystem::path & path) { boost::filesystem::path p; path = GetAppDataFolder(p) / stringToPath(COMPANY); boost::filesystem::create_directories(path); return path; }
CString CChordEaseApp::GetDataFolderPath() { CString path(GetMain()->GetOptions().m_DataFolderPath); if (path.IsEmpty()) { // if default data folder #ifdef PORTABLE_APP // if portable app path = GetAppFolder(); // use app folder #else // not portable app GetAppDataFolder(path); // use app data folder #endif } return(path); }
// sets applicaton name (defaults with current executable title if not used) // allows easy separation of installer from main application code // if you want to deploy a small installer Updater &Updater::SetAppName(String const &_appName) { appName = _appName; // gets app's user config path #ifdef PLATFORM_POSIX userConfigPath = AppendFileName("/home", user + "/." + appName); #else userConfigPath = AppendFileName(GetAppDataFolder(), appName); #endif // gets app's system config path #ifdef PLATFORM_POSIX systemConfigPath = AppendFileName("/usr/share", appName); #else systemConfigPath = AppendFileName(GetProgramsFolder(), appName); #endif // checks wether app is already installed and gather its version installedVersion.Clear(); #ifdef PLATFORM_POSIX appInstalled = FileExists(AppendFileName(GetProgramsFolder(), appName)); #else appInstalled = FileExists(AppendFileName(GetProgramsFolder(), appName + "/" + appName + ".exe")); #endif appInstalled &= FileExists(AppendFileName(systemConfigPath, "version")); String verStr; if(appInstalled) { verStr = LoadFile(AppendFileName(systemConfigPath, "version")); if(verStr != "") installedVersion = verStr; } return *this; }