2010-01-07 18:42:56 +01:00
|
|
|
/* Copyright (C) 2009 Wildfire Games.
|
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_PS_GAMESETUP_PATHS
|
|
|
|
#define INCLUDED_PS_GAMESETUP_PATHS
|
|
|
|
|
2011-03-23 15:43:35 +01:00
|
|
|
#include "lib/os_path.h"
|
2010-01-07 18:42:56 +01:00
|
|
|
#include "CmdLineArgs.h"
|
|
|
|
|
|
|
|
class Paths
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Paths(const CmdLineArgs& args);
|
|
|
|
|
2011-03-23 14:36:20 +01:00
|
|
|
const OsPath& Root() const
|
2010-01-07 18:42:56 +01:00
|
|
|
{
|
|
|
|
return m_root;
|
|
|
|
}
|
|
|
|
|
2011-03-23 14:36:20 +01:00
|
|
|
const OsPath& RData() const
|
2010-01-07 18:42:56 +01:00
|
|
|
{
|
|
|
|
return m_rdata;
|
|
|
|
}
|
|
|
|
|
2011-03-23 14:36:20 +01:00
|
|
|
const OsPath& Data() const
|
2010-01-07 18:42:56 +01:00
|
|
|
{
|
|
|
|
return m_data;
|
|
|
|
}
|
|
|
|
|
2011-03-23 14:36:20 +01:00
|
|
|
const OsPath& Config() const
|
2010-01-07 18:42:56 +01:00
|
|
|
{
|
|
|
|
return m_config;
|
|
|
|
}
|
|
|
|
|
2011-03-23 14:36:20 +01:00
|
|
|
const OsPath& Cache() const
|
2010-01-07 18:42:56 +01:00
|
|
|
{
|
|
|
|
return m_cache;
|
|
|
|
}
|
|
|
|
|
2011-03-23 14:36:20 +01:00
|
|
|
const OsPath& Logs() const
|
2010-01-07 18:42:56 +01:00
|
|
|
{
|
|
|
|
return m_logs;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-03-23 14:36:20 +01:00
|
|
|
static OsPath Root(const OsPath& argv0);
|
|
|
|
static OsPath XDG_Path(const char* envname, const OsPath& home, const OsPath& defaultPath);
|
2010-01-07 18:42:56 +01:00
|
|
|
|
|
|
|
// read-only directories, fixed paths relative to executable
|
2011-03-23 14:36:20 +01:00
|
|
|
OsPath m_root;
|
|
|
|
OsPath m_rdata;
|
2010-01-07 18:42:56 +01:00
|
|
|
|
|
|
|
// writable directories
|
2011-03-23 14:36:20 +01:00
|
|
|
OsPath m_data;
|
|
|
|
OsPath m_config;
|
|
|
|
OsPath m_cache;
|
|
|
|
OsPath m_logs; // special-cased in single-root-folder installations
|
2010-01-07 18:42:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // #ifndef INCLUDED_PS_GAMESETUP_PATHS
|