diff options
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/README.txt | 1 | ||||
-rw-r--r-- | src/app/main.cpp | 1 | ||||
-rw-r--r-- | src/app/system.cpp | 9 | ||||
-rw-r--r-- | src/app/system.h | 5 | ||||
-rw-r--r-- | src/app/system_linux.cpp | 31 | ||||
-rw-r--r-- | src/app/system_linux.h | 5 | ||||
-rw-r--r-- | src/app/system_other.cpp | 1 | ||||
-rw-r--r-- | src/app/system_other.h | 1 | ||||
-rw-r--r-- | src/app/system_windows.cpp | 27 | ||||
-rw-r--r-- | src/app/system_windows.h | 5 |
10 files changed, 48 insertions, 38 deletions
diff --git a/src/app/README.txt b/src/app/README.txt index 92be8a6..57a2785 100644 --- a/src/app/README.txt +++ b/src/app/README.txt @@ -2,3 +2,4 @@ * \dir src/app * Main class of the application and system functions */ + diff --git a/src/app/main.cpp b/src/app/main.cpp index edb5828..4bd5daa 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -122,3 +122,4 @@ int SDL_MAIN_FUNC(int argc, char *argv[]) } } // extern "C" + diff --git a/src/app/system.cpp b/src/app/system.cpp index 743ed96..2eb68ba 100644 --- a/src/app/system.cpp +++ b/src/app/system.cpp @@ -188,12 +188,13 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte return result; } -std::string CSystemUtils::profileFileLocation() +std::string CSystemUtils::GetProfileFileLocation() { - return std::string("colobot.ini"); + return std::string("colobot.ini"); } -std::string CSystemUtils::savegameDirectoryLocation() +std::string CSystemUtils::GetSavegameDirectoryLocation() { - return std::string("savegame"); + return std::string("savegame"); } + diff --git a/src/app/system.h b/src/app/system.h index 6ae05d6..d22a519 100644 --- a/src/app/system.h +++ b/src/app/system.h @@ -131,10 +131,10 @@ public: virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0; //! Returns the profile (colobot.ini) file location - virtual std::string profileFileLocation(); + virtual std::string GetProfileFileLocation(); //! Returns the savegame directory location - virtual std::string savegameDirectoryLocation(); + virtual std::string GetSavegameDirectoryLocation(); }; //! Global function to get CSystemUtils instance @@ -142,3 +142,4 @@ inline CSystemUtils* GetSystemUtils() { return CSystemUtils::GetInstancePointer(); } + diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp index 01dd850..492af7d 100644 --- a/src/app/system_linux.cpp +++ b/src/app/system_linux.cpp @@ -95,9 +95,9 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT (after->clockTime.tv_sec - before->clockTime.tv_sec) * 1000000000ll; } -std::string CSystemUtilsLinux::profileFileLocation() +std::string CSystemUtilsLinux::GetProfileFileLocation() { - std::string m_profileFile; + std::string profileFile; // Determine profileFile according to XDG Base Directory Specification char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME"); @@ -106,25 +106,25 @@ std::string CSystemUtilsLinux::profileFileLocation() char *envHOME = getenv("HOME"); if (envHOME == NULL) { - m_profileFile = "colobot.ini"; + profileFile = "colobot.ini"; } else { - m_profileFile = std::string(envHOME) + "/.config/colobot.ini"; + profileFile = std::string(envHOME) + "/.config/colobot.ini"; } } else { - m_profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini"; + profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini"; } - GetLogger()->Trace("Profile configuration is %s\n", m_profileFile.c_str()); + GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str()); - return m_profileFile; + return profileFile; } -std::string CSystemUtilsLinux::savegameDirectoryLocation() +std::string CSystemUtilsLinux::GetSavegameDirectoryLocation() { - std::string m_savegameDir; + std::string savegameDir; // Determine savegame dir according to XDG Base Directory Specification char *envXDG_DATA_HOME = getenv("XDG_CONFIG_DATA"); @@ -133,18 +133,19 @@ std::string CSystemUtilsLinux::savegameDirectoryLocation() char *envHOME = getenv("HOME"); if (envHOME == NULL) { - m_savegameDir = "/tmp/colobot-savegame"; + savegameDir = "/tmp/colobot-savegame"; } else - { - m_savegameDir = std::string(envHOME) + "/.local/share/colobot"; + { + savegameDir = std::string(envHOME) + "/.local/share/colobot"; } } else { - m_savegameDir = std::string(envXDG_DATA_HOME) + "/colobot"; + savegameDir = std::string(envXDG_DATA_HOME) + "/colobot"; } - GetLogger()->Trace("Saved game files are going to %s\n", m_savegameDir.c_str()); + GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); - return m_savegameDir; + return savegameDir; } + diff --git a/src/app/system_linux.h b/src/app/system_linux.h index a9a5a52..212d840 100644 --- a/src/app/system_linux.h +++ b/src/app/system_linux.h @@ -46,9 +46,10 @@ public: virtual long long GetTimeStampExactResolution() override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; - virtual std::string profileFileLocation() override; - virtual std::string savegameDirectoryLocation() override; + virtual std::string GetProfileFileLocation() override; + virtual std::string GetSavegameDirectoryLocation() override; private: bool m_zenityAvailable; }; + diff --git a/src/app/system_other.cpp b/src/app/system_other.cpp index 9fc1f95..da81a6d 100644 --- a/src/app/system_other.cpp +++ b/src/app/system_other.cpp @@ -37,3 +37,4 @@ long long int CSystemUtilsOther::TimeStampExactDiff(SystemTimeStamp* before, Sys { return (after->sdlTicks - before->sdlTicks) * 1000000ll; } + diff --git a/src/app/system_other.h b/src/app/system_other.h index bf16c80..b10a326 100644 --- a/src/app/system_other.h +++ b/src/app/system_other.h @@ -46,3 +46,4 @@ public: virtual long long GetTimeStampExactResolution() override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; }; + diff --git a/src/app/system_windows.cpp b/src/app/system_windows.cpp index 870683f..f48d4e0 100644 --- a/src/app/system_windows.cpp +++ b/src/app/system_windows.cpp @@ -111,38 +111,39 @@ std::wstring CSystemUtilsWindows::UTF8_Decode(const std::string& str) } -std::string CSystemUtilsWindows::profileFileLocation() +std::string CSystemUtilsWindows::GetProfileFileLocation() { - std::string m_profileFile; + std::string profileFile; char* envUSERPROFILE = getenv("USERPROFILE"); if (envUSERPROFILE == NULL) { - m_profileFile = "colobot.ini"; + profileFile = "colobot.ini"; } else { - m_profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini"; + profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini"; } - GetLogger()->Trace("Profile configuration is %s\n", m_profileFile.c_str()); + GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str()); - return m_profileFile; + return profileFile; } -std::string CSystemUtilsWindows::savegameDirectoryLocation() +std::string CSystemUtilsWindows::GetSavegameDirectoryLocation() { - std::string m_savegameDir; + std::string savegameDir; char* envUSERPROFILE = getenv("USERPROFILE"); if (envUSERPROFILE == NULL) { - m_savegameDir = "savegame"; + savegameDir = "savegame"; } else { - m_savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame"; + savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame"; } - GetLogger()->Trace("Saved game files are going to %s\n", m_savegameDir.c_str()); + GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); + + return savegameDir; +} - return m_savegameDir; -}
\ No newline at end of file diff --git a/src/app/system_windows.h b/src/app/system_windows.h index 88e7507..fbc71a1 100644 --- a/src/app/system_windows.h +++ b/src/app/system_windows.h @@ -44,8 +44,8 @@ public: virtual long long GetTimeStampExactResolution() override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; - virtual std::string profileFileLocation() override; - virtual std::string savegameDirectoryLocation() override; + virtual std::string GetProfileFileLocation() override; + virtual std::string GetSavegameDirectoryLocation() override; private: std::string UTF8_Encode(const std::wstring &wstr); @@ -54,3 +54,4 @@ private: protected: long long m_counterFrequency; }; + |