std::wstring getAppDataPath(std::wstring extra) { #ifdef NIX #if defined(USE_XDG_DIRS) std::string configPath = getenv("XDG_CONFIG_HOME"); configPath.append("/desura"); #elif defined(USE_SINGLE_HOME_DIR) std::string configPath = getenv("HOME"); configPath.append("/.desura"); #elif defined(USE_PORTABLE_DIR) std::string configPath = UTIL::STRING::toStr(getCurrentDir(L"config")); #endif if (extra.size() > 0) extra.insert(0, DIRS_WSTR); return UTIL::STRING::toWStr(configPath) + extra; #else wchar_t path[MAX_PATH]; getSystemPath(CSIDL_COMMON_APPDATA, path); gcWString out(path); out += DIRS_WSTR; out += COMMONAPP_PATH_W; if (extra.size() > 0) { out += DIRS_WSTR; out += extra; } return out; #endif }
bool operator<( FullID const& rhs ) const { // first look at the EntityType if( getEntityType() != rhs.getEntityType() ) { return getEntityType() < rhs.getEntityType(); } // then compare the SystemPaths // FIXME: should be faster is there is SystemPath::compare() if( getSystemPath() != rhs.getSystemPath() ) { return getSystemPath() < rhs.getSystemPath(); } // finally compare the ID strings return getID() < rhs.getID(); }
bool operator==( FullID const& rhs ) const { // first look at the EntityType if( getEntityType() != rhs.getEntityType() ) { return false; } // then compare the SystemPaths if( getSystemPath() != rhs.getSystemPath() ) { return false; } // finally compare the ID strings return getID() == rhs.getID(); }
std::wstring getDesktopPath(std::wstring extra) { #ifdef WIN32 wchar_t path[MAX_PATH]; getSystemPath(CSIDL_DESKTOP, path); std::wstring out(path); if (extra.size() > 0) { out += L"\\"; out += extra; } return out; #else return UTIL::LIN::getDesktopPath(extra); #endif }
std::wstring getStartMenuProgramsPath(std::wstring extra) { #ifdef WIN32 wchar_t path[MAX_PATH]; getSystemPath(CSIDL_COMMON_PROGRAMS, path); std::wstring out(path); if (extra.size() > 0) { out += L"\\"; out += extra; } return out; #else return UTIL::LIN::getApplicationsPath(extra); #endif }
std::wstring getCommonProgramFilesPath(std::wstring extra) { #ifdef WIN32 wchar_t path[MAX_PATH]; getSystemPath(CSIDL_PROGRAM_FILES_COMMON, path); std::wstring out(path); out += L"\\Desura"; if (extra.size() > 0) { out += L"\\"; out += extra; } return out; #else //TODO LINUX return L""; #endif }
std::wstring getTempInternetPath(std::wstring extra) { #ifdef WIN32 wchar_t path[MAX_PATH]; getSystemPath(CSIDL_INTERNET_CACHE, path); std::wstring out(path); out += L"\\"; out += COMMONAPP_PATH_W; if (extra.size() > 0) { out += L"\\"; out += extra; } return out; #else //TODO LINUX return L""; #endif }
std::wstring getLocalAppDataPath(std::wstring extra) { #ifdef WIN32 wchar_t path[MAX_PATH]; getSystemPath(CSIDL_LOCAL_APPDATA, path); std::wstring out(path); out += L"\\"; out += COMMONAPP_PATH_W; if (extra.size() > 0) { out += L"\\"; out += extra; } return out; #else //TODO LINUX return L""; #endif }
FullID Entity::getFullID() const { return FullID( getEntityType(), getSystemPath(), getID() ); }