summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-10-19 16:18:36 +0200
committerkrzys-h <krzys_h@interia.pl>2014-10-19 16:18:36 +0200
commit0245fdc6c328edf65b4fd9f45be4f440ef92b6eb (patch)
treed8237bdeacdee273c2eabaefc14f21637c1f489a /src/app
parentd7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6 (diff)
parent83abb8ca8e74176d64944e9681d74aa11ef6cdf9 (diff)
downloadcolobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.tar.gz
colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.tar.bz2
colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.zip
Merge branch 'dev-physfs' into dev
Conflicts: src/app/app.cpp
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.cpp120
-rw-r--r--src/app/app.h16
-rw-r--r--src/app/gamedata.cpp139
-rw-r--r--src/app/gamedata.h69
-rw-r--r--src/app/main.cpp2
-rw-r--r--src/app/pausemanager.cpp18
-rw-r--r--src/app/system.cpp10
-rw-r--r--src/app/system.h7
-rw-r--r--src/app/system_linux.cpp34
-rw-r--r--src/app/system_linux.h3
-rw-r--r--src/app/system_macosx.cpp14
-rw-r--r--src/app/system_macosx.h3
-rw-r--r--src/app/system_windows.cpp25
-rw-r--r--src/app/system_windows.h3
14 files changed, 110 insertions, 353 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 77930ed..06e3f01 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -21,7 +21,6 @@
#include "app/app.h"
-#include "app/gamedata.h"
#include "app/system.h"
#include "common/logger.h"
@@ -29,6 +28,7 @@
#include "common/image.h"
#include "common/key.h"
#include "common/stringutils.h"
+#include "common/resources/resourcemanager.h"
#include "graphics/engine/modelmanager.h"
#include "graphics/opengl/gldevice.h"
@@ -103,7 +103,6 @@ CApplication::CApplication()
m_objMan = new CObjectManager();
m_eventQueue = new CEventQueue();
m_profile = new CProfile();
- m_gameData = new CGameData();
m_engine = nullptr;
m_device = nullptr;
@@ -114,7 +113,6 @@ CApplication::CApplication()
m_exitCode = 0;
m_active = false;
m_debugModes = 0;
- m_customDataPath = false;
m_windowTitle = "COLOBOT: Gold Edition";
@@ -157,11 +155,17 @@ CApplication::CApplication()
#else
m_dataPath = GetSystemUtils()->GetDataPath();
m_langPath = GetSystemUtils()->GetLangPath();
+ #endif
+
+ #ifdef DEV_BUILD
+ m_savePath = "./saves";
+ #else
+ m_savePath = GetSystemUtils()->GetSaveDir();
#endif
m_runSceneName = "";
m_runSceneRank = 0;
-
+
m_sceneTest = false;
m_language = LANGUAGE_ENV;
@@ -187,9 +191,6 @@ CApplication::~CApplication()
delete m_iMan;
m_iMan = nullptr;
-
- delete m_gameData;
- m_gameData = nullptr;
GetSystemUtils()->DestroyTimeStamp(m_baseTimeStamp);
GetSystemUtils()->DestroyTimeStamp(m_curTimeStamp);
@@ -222,9 +223,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
OPT_SCENETEST,
OPT_LOGLEVEL,
OPT_LANGUAGE,
+ OPT_LANGDIR,
OPT_DATADIR,
+ OPT_SAVEDIR,
OPT_MOD,
- OPT_LANGDIR,
OPT_VBO
};
@@ -236,9 +238,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
{ "scenetest", no_argument, nullptr, OPT_SCENETEST },
{ "loglevel", required_argument, nullptr, OPT_LOGLEVEL },
{ "language", required_argument, nullptr, OPT_LANGUAGE },
+ { "langdir", required_argument, nullptr, OPT_LANGDIR },
{ "datadir", required_argument, nullptr, OPT_DATADIR },
+ { "savedir", required_argument, nullptr, OPT_SAVEDIR },
{ "mod", required_argument, nullptr, OPT_MOD },
- { "langdir", required_argument, nullptr, OPT_LANGDIR },
{ "vbo", required_argument, nullptr, OPT_VBO },
{ nullptr, 0, nullptr, 0}
};
@@ -276,9 +279,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Message(" -scenetest win every mission right after it's loaded\n");
GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n");
GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl, ru)\n");
- GetLogger()->Message(" -datadir path set custom data directory path\n");
- GetLogger()->Message(" -mod path run mod\n");
GetLogger()->Message(" -langdir path set custom language directory path\n");
+ GetLogger()->Message(" -datadir path set custom data directory path\n");
+ GetLogger()->Message(" -savedir path set custom save directory path (must be writable)\n");
+ GetLogger()->Message(" -mod path load datadir mod from given path\n");
GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n");
return PARSE_ARGS_HELP;
}
@@ -341,25 +345,6 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
m_language = language;
break;
}
- case OPT_DATADIR:
- {
- m_dataPath = optarg;
- m_customDataPath = true;
- GetLogger()->Info("Using datadir: '%s'\n", optarg);
- break;
- }
- case OPT_MOD:
- {
- m_gameData->AddMod(std::string(optarg));
- GetLogger()->Info("Running mod from path: '%s'\n", optarg);
- break;
- }
- case OPT_LANGDIR:
- {
- m_langPath = optarg;
- GetLogger()->Info("Using language dir: '%s'\n", m_langPath.c_str());
- break;
- }
case OPT_VBO:
{
std::string vbo;
@@ -378,6 +363,30 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
break;
}
+ case OPT_DATADIR:
+ {
+ m_dataPath = optarg;
+ GetLogger()->Info("Using data dir: '%s'\n", optarg);
+ break;
+ }
+ case OPT_LANGDIR:
+ {
+ m_langPath = optarg;
+ GetLogger()->Info("Using language dir: '%s'\n", optarg);
+ break;
+ }
+ case OPT_SAVEDIR:
+ {
+ m_savePath = optarg;
+ GetLogger()->Info("Using save dir: '%s'\n", optarg);
+ break;
+ }
+ case OPT_MOD:
+ {
+ GetLogger()->Info("Loading mod: '%s'\n", optarg);
+ CResourceManager::AddLocation(optarg, true);
+ break;
+ }
default:
assert(false); // should never get here
}
@@ -393,30 +402,32 @@ bool CApplication::Create()
GetLogger()->Info("Creating CApplication\n");
- if (!GetProfile().Init())
- {
- GetLogger()->Warn("Config not found. Default values will be used!\n");
- defaultValues = true;
- }
- else
- {
- if (!m_customDataPath && GetProfile().GetStringProperty("Resources", "Data", path))
- m_dataPath = path;
- }
-
boost::filesystem::path dataPath(m_dataPath);
if (! (boost::filesystem::exists(dataPath) && boost::filesystem::is_directory(dataPath)) )
{
GetLogger()->Error("Data directory '%s' doesn't exist or is not a directory\n", m_dataPath.c_str());
m_errorMessage = std::string("Could not read from data directory:\n") +
- std::string("'") + m_dataPath + std::string("'\n") +
- std::string("Please check your installation, or supply a valid data directory by -datadir option.");
+ std::string("'") + m_dataPath + std::string("'\n") +
+ std::string("Please check your installation, or supply a valid data directory by -datadir option.");
m_exitCode = 1;
return false;
}
-
- m_gameData->SetDataDir(std::string(m_dataPath));
- m_gameData->Init();
+
+ boost::filesystem::create_directories(m_savePath);
+ boost::filesystem::create_directories(m_savePath+"/mods");
+
+ LoadModsFromDir(m_dataPath+"/mods");
+ LoadModsFromDir(m_savePath+"/mods");
+
+ CResourceManager::AddLocation(m_dataPath, false);
+ CResourceManager::SetSaveLocation(m_savePath);
+ CResourceManager::AddLocation(m_savePath, true);
+
+ if (!GetProfile().Init())
+ {
+ GetLogger()->Warn("Config not found. Default values will be used!\n");
+ defaultValues = true;
+ }
if (GetProfile().GetStringProperty("Language", "Lang", path)) {
Language language;
@@ -601,6 +612,23 @@ bool CApplication::CreateVideoSurface()
return true;
}
+void CApplication::LoadModsFromDir(const std::string &dir)
+{
+ try {
+ boost::filesystem::directory_iterator iterator(dir);
+ for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
+ {
+ std::string fn = iterator->path().string();
+ CLogger::GetInstancePointer()->Info("Loading mod: '%s'\n", fn.c_str());
+ CResourceManager::AddLocation(fn, false);
+ }
+ }
+ catch(std::exception &e)
+ {
+ CLogger::GetInstancePointer()->Warn("Unable to load mods from directory '%s': %s\n", dir.c_str(), e.what());
+ }
+}
+
void CApplication::Destroy()
{
m_joystickEnabled = false;
diff --git a/src/app/app.h b/src/app/app.h
index 21ece4c..c73cb53 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -44,7 +44,6 @@ class CInstanceManager;
class CEventQueue;
class CRobotMain;
class CSoundInterface;
-class CGameData;
namespace Gfx {
class CModelManager;
@@ -357,6 +356,9 @@ public:
protected:
//! Creates the window's SDL_Surface
bool CreateVideoSurface();
+
+ //! Loads all mods from given directory
+ void LoadModsFromDir(const std::string &dir);
//! Processes the captured SDL event to Event struct
Event ProcessSystemEvent();
@@ -404,8 +406,6 @@ protected:
CRobotMain* m_robotMain;
//! Profile (INI) reader/writer
CProfile* m_profile;
- //! Game data
- CGameData* m_gameData;
//! Code to return at exit
int m_exitCode;
@@ -469,16 +469,16 @@ protected:
std::vector<int> m_joyAxeState;
//! Current state of joystick buttons; may be updated from another thread
std::vector<bool> m_joyButtonState;
-
+
//! Path to directory with data files
std::string m_dataPath;
-
- //! True if datadir was passed in command line
- bool m_customDataPath;
-
+
//! Path to directory with language files
std::string m_langPath;
+ //! Path to directory with save files
+ std::string m_savePath;
+
//@{
//! Scene to run on startup
std::string m_runSceneName;
diff --git a/src/app/gamedata.cpp b/src/app/gamedata.cpp
deleted file mode 100644
index f758716..0000000
--- a/src/app/gamedata.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * This file is part of the Colobot: Gold Edition source code
- * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
- * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
- *
- * This program 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 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program. If not, see http://gnu.org/licenses
- */
-
-#include "app/gamedata.h"
-
-
-#include "app/app.h"
-
-#include <boost/filesystem.hpp>
-
-template<> CGameData* CSingleton<CGameData>::m_instance = nullptr;
-
-CGameData::CGameData()
-{
- m_dataDirSet = false;
-
- for (int i = 0; i < DIR_MAX; ++i)
- m_standardDataDirs[i] = nullptr;
-
- m_standardDataDirs[DIR_AI] = "ai";
- m_standardDataDirs[DIR_FONT] = "fonts";
- m_standardDataDirs[DIR_HELP] = "help";
- m_standardDataDirs[DIR_ICON] = "icons";
- m_standardDataDirs[DIR_LEVEL] = "levels";
- m_standardDataDirs[DIR_MODEL] = "models";
- m_standardDataDirs[DIR_MUSIC] = "music";
- m_standardDataDirs[DIR_SOUND] = "sounds";
- m_standardDataDirs[DIR_TEXTURE] = "textures";
-}
-
-CGameData::~CGameData()
-{
-}
-
-void CGameData::SetDataDir(std::string path)
-{
- assert(!m_dataDirSet);
- m_dataDirSet = true;
-
- m_dataDirs.insert(m_dataDirs.begin(), path);
-}
-
-void CGameData::AddMod(std::string path)
-{
- m_dataDirs.push_back(path);
-}
-
-void CGameData::Init()
-{
- std::string out = "Using datadirs: ";
- bool first = true;
- for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
- if(!first) out += ", ";
- first = false;
- out += *rit;
- }
- out += "\n";
- CLogger::GetInstancePointer()->Info(out.c_str());
-}
-
-std::string CGameData::GetFilePath(DataDir dir, const std::string& subpath)
-{
- int index = static_cast<int>(dir);
- assert(index >= 0 && index < DIR_MAX);
-
- for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
- std::stringstream str;
-
- if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot
- str << *rit;
- str << "/";
- str << m_standardDataDirs[index];
-
- if (dir == DIR_HELP)
- {
- str << "/";
- str << CApplication::GetInstancePointer()->GetLanguageChar();
- }
- str << "/";
- }
-
- str << subpath;
-
- boost::filesystem::path path(str.str());
- if(boost::filesystem::exists(path))
- {
- return str.str();
- }
- }
-
- if(m_dataDirs.size() > 0) {
- std::stringstream str;
- if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot
- str << m_dataDirs[0];
- str << "/";
- str << m_standardDataDirs[index];
-
- if (dir == DIR_HELP)
- {
- str << "/";
- str << CApplication::GetInstancePointer()->GetLanguageChar();
- }
- str << "/";
- }
- str << subpath;
- return str.str();
- }
-
- return subpath;
-}
-
-std::string CGameData::GetDataPath(const std::string &subpath)
-{
- for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
- std::string path = *rit + "/" + subpath;
- boost::filesystem::path boostPath(path);
- if(boost::filesystem::exists(boostPath))
- {
- return path;
- }
- }
- return m_dataDirs[0] + "/" + subpath;
-}
diff --git a/src/app/gamedata.h b/src/app/gamedata.h
deleted file mode 100644
index 1164d60..0000000
--- a/src/app/gamedata.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * This file is part of the Colobot: Gold Edition source code
- * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
- * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
- *
- * This program 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 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program. If not, see http://gnu.org/licenses
- */
-
-/**
- * \file app/gamedata.h
- * \brief Game data
- */
-
-#pragma once
-
-#include "common/singleton.h"
-
-#include <string>
-#include <vector>
-
-/**
- * \enum DataDir
- * \brief Directories in data directory
- */
-enum DataDir
-{
- DIR_AI, //! < ai scripts
- DIR_FONT, //! < fonts
- DIR_HELP, //! < help files
- DIR_ICON, //! < icons & images
- DIR_LEVEL, //! < levels
- DIR_MODEL, //! < models
- DIR_MUSIC, //! < music
- DIR_SOUND, //! < sounds
- DIR_TEXTURE, //! < textures
-
- DIR_MAX //! < number of dirs
-};
-
-class CGameData : public CSingleton<CGameData>
-{
-public:
- CGameData();
- ~CGameData();
-
- void Init();
- void SetDataDir(std::string path);
- void AddMod(std::string path);
-
- std::string GetFilePath(DataDir dir, const std::string &subpath);
- std::string GetDataPath(const std::string &subpath);
-
-private:
- bool m_dataDirSet;
- std::vector<std::string> m_dataDirs;
- const char* m_standardDataDirs[DIR_MAX];
-};
-
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 27952db..e30a83d 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -71,6 +71,7 @@ The current layout is the following:
- src/script - link with the CBot library
*/
+#include "common/resources/resourcemanager.h"
//! Entry point to the program
extern "C"
@@ -79,6 +80,7 @@ extern "C"
int SDL_MAIN_FUNC(int argc, char *argv[])
{
CLogger logger; // single istance of logger
+ CResourceManager manager(argv[0]);
// Initialize static string arrays
InitializeRestext();
diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp
index 3376ae4..b28565f 100644
--- a/src/app/pausemanager.cpp
+++ b/src/app/pausemanager.cpp
@@ -31,7 +31,7 @@ template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr;
CPauseManager::CPauseManager()
{
m_sound = CApplication::GetInstancePointer()->GetSound();
-
+
m_pause = PAUSE_NONE;
}
@@ -42,24 +42,28 @@ CPauseManager::~CPauseManager()
void CPauseManager::SetPause(PauseType pause)
{
- if(pause != PAUSE_NONE) {
- if(m_pause != pause) {
+ if (pause != PAUSE_NONE)
+ {
+ if (m_pause != pause)
+ {
CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str());
CRobotMain::GetInstancePointer()->StartPauseMusic(pause);
}
-
+
m_pause = pause;
- } else
+ }
+ else
ClearPause();
}
void CPauseManager::ClearPause()
{
- if(m_pause != PAUSE_NONE) {
+ if(m_pause != PAUSE_NONE)
+ {
CLogger::GetInstancePointer()->Info("Game resumed\n");
m_sound->StopPauseMusic();
}
-
+
m_pause = PAUSE_NONE;
}
diff --git a/src/app/system.cpp b/src/app/system.cpp
index 118bc80..2ceea6a 100644
--- a/src/app/system.cpp
+++ b/src/app/system.cpp
@@ -204,13 +204,7 @@ std::string CSystemUtils::GetLangPath()
return COLOBOT_I18N_DIR;
}
-std::string CSystemUtils::GetProfileFileLocation()
+std::string CSystemUtils::GetSaveDir()
{
- return std::string("colobot.ini");
+ return std::string("save");
}
-
-std::string CSystemUtils::GetSavegameDirectoryLocation()
-{
- return std::string("savegame");
-}
-
diff --git a/src/app/system.h b/src/app/system.h
index 36e558a..d52020b 100644
--- a/src/app/system.h
+++ b/src/app/system.h
@@ -138,11 +138,8 @@ public:
//! Returns the translations path
virtual std::string GetLangPath();
- //! Returns the profile (colobot.ini) file location
- virtual std::string GetProfileFileLocation();
-
- //! Returns the savegame directory location
- virtual std::string GetSavegameDirectoryLocation();
+ //! Returns the save dir location
+ virtual std::string GetSaveDir();
};
//! Global function to get CSystemUtils instance
diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp
index a10e371..6fbfb05 100644
--- a/src/app/system_linux.cpp
+++ b/src/app/system_linux.cpp
@@ -27,7 +27,7 @@
void CSystemUtilsLinux::Init()
{
m_zenityAvailable = true;
- if (system("zenity --version") != 0)
+ if (system("zenity --version 1> /dev/null 2> /dev/null") != 0)
{
m_zenityAvailable = false;
GetLogger()->Warn("Zenity not available, will fallback to console users dialogs.\n");
@@ -97,34 +97,7 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT
(after->clockTime.tv_sec - before->clockTime.tv_sec) * 1000000000ll;
}
-std::string CSystemUtilsLinux::GetProfileFileLocation()
-{
- std::string profileFile;
-
- // Determine profileFile according to XDG Base Directory Specification
- char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME");
- if (envXDG_CONFIG_HOME == NULL)
- {
- char *envHOME = getenv("HOME");
- if (envHOME == NULL)
- {
- profileFile = "colobot.ini";
- }
- else
- {
- profileFile = std::string(envHOME) + "/.config/colobot.ini";
- }
- }
- else
- {
- profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini";
- }
- GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str());
-
- return profileFile;
-}
-
-std::string CSystemUtilsLinux::GetSavegameDirectoryLocation()
+std::string CSystemUtilsLinux::GetSaveDir()
{
std::string savegameDir;
@@ -135,7 +108,7 @@ std::string CSystemUtilsLinux::GetSavegameDirectoryLocation()
char *envHOME = getenv("HOME");
if (envHOME == NULL)
{
- savegameDir = "/tmp/colobot-savegame";
+ savegameDir = "/tmp/colobot-save";
}
else
{
@@ -150,4 +123,3 @@ std::string CSystemUtilsLinux::GetSavegameDirectoryLocation()
return savegameDir;
}
-
diff --git a/src/app/system_linux.h b/src/app/system_linux.h
index 2b32660..5f4fcc3 100644
--- a/src/app/system_linux.h
+++ b/src/app/system_linux.h
@@ -48,8 +48,7 @@ public:
virtual long long GetTimeStampExactResolution() override;
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
- virtual std::string GetProfileFileLocation() override;
- virtual std::string GetSavegameDirectoryLocation() override;
+ virtual std::string GetSaveDir() override;
private:
bool m_zenityAvailable;
diff --git a/src/app/system_macosx.cpp b/src/app/system_macosx.cpp
index c44831f..208b4a7 100644
--- a/src/app/system_macosx.cpp
+++ b/src/app/system_macosx.cpp
@@ -99,20 +99,10 @@ std::string CSystemUtilsMacOSX::GetLangPath()
return m_dataPath + "/i18n";
}
-std::string CSystemUtilsMacOSX::GetProfileFileLocation()
+std::string CSystemUtilsMacOSX::GetSaveDir()
{
- std::string profileFile = m_ASPath + "/colobot.ini";
-
- GetLogger()->Trace("Profile file is %s\n", profileFile.c_str());
- return profileFile;
-}
-
-std::string CSystemUtilsMacOSX::GetSavegameDirectoryLocation()
-{
- std::string savegameDir = m_ASPath + "/savegame";
- boost::filesystem::create_directories(savegameDir.c_str());
+ std::string savegameDir = m_ASPath;
GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
return savegameDir;
}
-
diff --git a/src/app/system_macosx.h b/src/app/system_macosx.h
index 39c5702..9063aab 100644
--- a/src/app/system_macosx.h
+++ b/src/app/system_macosx.h
@@ -32,8 +32,7 @@ public:
virtual std::string GetDataPath() override;
virtual std::string GetLangPath() override;
- virtual std::string GetProfileFileLocation() override;
- virtual std::string GetSavegameDirectoryLocation() override;
+ virtual std::string GetSaveDir() override;
private:
std::string m_ASPath;
std::string m_dataPath;
diff --git a/src/app/system_windows.cpp b/src/app/system_windows.cpp
index 9f4cd2c..a2ea18f 100644
--- a/src/app/system_windows.cpp
+++ b/src/app/system_windows.cpp
@@ -113,39 +113,20 @@ std::wstring CSystemUtilsWindows::UTF8_Decode(const std::string& str)
}
-std::string CSystemUtilsWindows::GetProfileFileLocation()
-{
- std::string profileFile;
-
- char* envUSERPROFILE = getenv("USERPROFILE");
- if (envUSERPROFILE == NULL)
- {
- profileFile = "colobot.ini";
- }
- else
- {
- profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini";
- }
- GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str());
-
- return profileFile;
-}
-
-std::string CSystemUtilsWindows::GetSavegameDirectoryLocation()
+std::string CSystemUtilsWindows::GetSaveDir()
{
std::string savegameDir;
char* envUSERPROFILE = getenv("USERPROFILE");
if (envUSERPROFILE == NULL)
{
- savegameDir = "savegame";
+ savegameDir = "save";
}
else
{
- savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame";
+ savegameDir = std::string(envUSERPROFILE) + "\\colobot";
}
GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str());
return savegameDir;
}
-
diff --git a/src/app/system_windows.h b/src/app/system_windows.h
index 2d8e146..9175a44 100644
--- a/src/app/system_windows.h
+++ b/src/app/system_windows.h
@@ -46,8 +46,7 @@ public:
virtual long long GetTimeStampExactResolution() override;
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
- virtual std::string GetProfileFileLocation() override;
- virtual std::string GetSavegameDirectoryLocation() override;
+ virtual std::string GetSaveDir() override;
private:
std::string UTF8_Encode(const std::wstring &wstr);