LCOV - code coverage report
Current view: top level - source/ps/GameSetup - Paths.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 11 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2012 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #ifndef INCLUDED_PS_GAMESETUP_PATHS
      19             : #define INCLUDED_PS_GAMESETUP_PATHS
      20             : 
      21             : #include "lib/os_path.h"
      22             : #include "CmdLineArgs.h"
      23             : 
      24             : /**
      25             :  * Wrapper class for OS paths used by the game
      26             :  */
      27           0 : class Paths
      28             : {
      29             : public:
      30             :     Paths(const CmdLineArgs& args);
      31             : 
      32             :     /**
      33             :      * Returns the game's root directory
      34             :      */
      35             :     const OsPath& Root() const
      36             :     {
      37             :         return m_root;
      38             :     }
      39             : 
      40             :     /**
      41             :      * Returns directory for read-only data installed with the game
      42             :      */
      43           0 :     const OsPath& RData() const
      44             :     {
      45           0 :         return m_rdata;
      46             :     }
      47             : 
      48             :     /**
      49             :      * Returns directory for game-managed data and mods
      50             :      */
      51             :     const OsPath& GameData() const
      52             :     {
      53             :         return m_gameData;
      54             :     }
      55             : 
      56             :     /**
      57             :      * Returns directory for user-created data
      58             :      * Only things created in response to an explicit user action should go here.
      59             :      * (note: only Windows currently treats this differently than GameData)
      60             :      */
      61           0 :     const OsPath& UserData() const
      62             :     {
      63           0 :         return m_userData;
      64             :     }
      65             : 
      66             :     /**
      67             :      * Returns config file directory
      68             :      */
      69           0 :     const OsPath& Config() const
      70             :     {
      71           0 :         return m_config;
      72             :     }
      73             : 
      74             :     /**
      75             :      * Returns cache directory
      76             :      */
      77           0 :     const OsPath& Cache() const
      78             :     {
      79           0 :         return m_cache;
      80             :     }
      81             : 
      82             :     /**
      83             :      * Returns logs directory
      84             :      */
      85           0 :     const OsPath& Logs() const
      86             :     {
      87           0 :         return m_logs;
      88             :     }
      89             : 
      90             : private:
      91             :     static OsPath Root(const OsPath& argv0);
      92             :     static OsPath RootData(const OsPath& argv0);
      93             :     static OsPath XDG_Path(const char* envname, const OsPath& home, const OsPath& defaultPath);
      94             : 
      95             :     // read-only directories, fixed paths relative to executable
      96             :     OsPath m_root;
      97             :     OsPath m_rdata;
      98             : 
      99             :     // writable directories
     100             :     OsPath m_gameData;
     101             :     OsPath m_userData;
     102             :     OsPath m_config;
     103             :     OsPath m_cache;
     104             :     OsPath m_logs;  // special-cased in single-root-folder installations
     105             : };
     106             : 
     107             : #endif  // #ifndef INCLUDED_PS_GAMESETUP_PATHS

Generated by: LCOV version 1.13