2013-03-02 21:41:25 +03:00
|
|
|
/*
|
|
|
|
* VCMIDirs.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-08-09 18:22:37 +03:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "VCMIDirs.h"
|
2014-03-04 17:51:10 +03:00
|
|
|
|
2022-08-15 15:29:11 +02:00
|
|
|
#ifdef VCMI_IOS
|
|
|
|
#include "iOS_utils.h"
|
2023-02-25 09:38:05 +02:00
|
|
|
#elif defined(VCMI_ANDROID)
|
|
|
|
#include "CAndroidVMHelper.h"
|
2022-08-15 15:29:11 +02:00
|
|
|
#endif
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
namespace bfs = boost::filesystem;
|
2014-03-04 17:51:10 +03:00
|
|
|
|
2022-09-17 15:56:01 +02:00
|
|
|
bfs::path IVCMIDirs::userLogsPath() const { return userCachePath(); }
|
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
bfs::path IVCMIDirs::userSavePath() const { return userDataPath() / "Saves"; }
|
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path IVCMIDirs::userExtractedPath() const { return userCachePath() / "extracted"; }
|
|
|
|
|
2017-05-25 19:57:20 +02:00
|
|
|
bfs::path IVCMIDirs::fullLibraryPath(const std::string &desiredFolder, const std::string &baseLibName) const
|
|
|
|
{
|
|
|
|
return libraryPath() / desiredFolder / libraryName(baseLibName);
|
|
|
|
}
|
|
|
|
|
2022-09-17 15:52:14 +02:00
|
|
|
std::string IVCMIDirs::genHelpString() const
|
|
|
|
{
|
|
|
|
std::vector<std::string> tempVec;
|
|
|
|
for (const bfs::path & path : dataPaths())
|
|
|
|
tempVec.push_back(path.string());
|
|
|
|
const auto gdStringA = boost::algorithm::join(tempVec, ":");
|
|
|
|
|
|
|
|
return
|
2022-11-24 22:15:46 +02:00
|
|
|
" game data: " + gdStringA + "\n"
|
|
|
|
" libraries: " + libraryPath().string() + "\n"
|
|
|
|
" server: " + serverPath().string() + "\n"
|
2022-09-17 15:52:14 +02:00
|
|
|
"\n"
|
2022-11-24 22:15:46 +02:00
|
|
|
" user data: " + userDataPath().string() + "\n"
|
|
|
|
" user cache: " + userCachePath().string() + "\n"
|
|
|
|
" user config: " + userConfigPath().string() + "\n"
|
|
|
|
" user logs: " + userLogsPath().string() + "\n"
|
2022-12-07 18:05:47 +02:00
|
|
|
" user saves: " + userSavePath().string() + "\n"
|
|
|
|
" user extracted: " + userExtractedPath().string() + "\n";
|
2022-09-17 15:52:14 +02:00
|
|
|
}
|
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
void IVCMIDirs::init()
|
|
|
|
{
|
|
|
|
// TODO: Log errors
|
2014-09-08 16:15:36 +03:00
|
|
|
bfs::create_directories(userDataPath());
|
|
|
|
bfs::create_directories(userCachePath());
|
|
|
|
bfs::create_directories(userConfigPath());
|
2022-09-17 15:56:01 +02:00
|
|
|
bfs::create_directories(userLogsPath());
|
2014-09-08 16:15:36 +03:00
|
|
|
bfs::create_directories(userSavePath());
|
2014-08-11 00:42:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef VCMI_WINDOWS
|
|
|
|
|
2014-09-11 16:53:25 +03:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#define _WIN32_IE 0x0500
|
|
|
|
|
|
|
|
#ifndef CSIDL_MYDOCUMENTS
|
|
|
|
#define CSIDL_MYDOCUMENTS CSIDL_PERSONAL
|
2016-01-26 15:51:38 +02:00
|
|
|
#endif
|
2014-09-11 16:53:25 +03:00
|
|
|
#endif // __MINGW32__
|
|
|
|
|
2015-11-03 13:40:36 +02:00
|
|
|
#include <windows.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <shellapi.h>
|
2014-08-09 20:54:12 +03:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
// Generates script file named _temp.bat in 'to' directory and runs it
|
|
|
|
// Script will:
|
|
|
|
// - Wait util 'exeName' ends.
|
|
|
|
// - Copy all files from 'from' to 'to'
|
|
|
|
// - Ask user to replace files existed in 'to'.
|
|
|
|
// - Run 'exeName'
|
|
|
|
// - Delete itself.
|
|
|
|
bool StartBatchCopyDataProgram(
|
|
|
|
const bfs::path& from, const bfs::path& to, const bfs::path& exeName,
|
|
|
|
const bfs::path& currentPath = bfs::current_path())
|
|
|
|
{
|
|
|
|
static const char base[] =
|
|
|
|
"@echo off" "\n"
|
|
|
|
"echo Preparing to move VCMI data system." "\n"
|
|
|
|
|
|
|
|
":CLIENT_RUNNING_LOOP" "\n"
|
|
|
|
"TASKLIST | FIND /I %1% > nul" "\n"
|
|
|
|
"IF ERRORLEVEL 1 (" "\n"
|
|
|
|
"GOTO CLIENT_NOT_RUNNING" "\n"
|
|
|
|
") ELSE (" "\n"
|
|
|
|
"echo %1% is still running..." "\n"
|
|
|
|
"echo Waiting until process ends..." "\n"
|
|
|
|
"ping 1.1.1.1 -n 1 -w 3000 > nul" "\n" // Sleep ~3 seconds. I love Windows :)
|
|
|
|
"goto :CLIENT_RUNNING_LOOP" "\n"
|
|
|
|
")" "\n"
|
|
|
|
|
|
|
|
":CLIENT_NOT_RUNNING" "\n"
|
|
|
|
"echo %1% turned off..." "\n"
|
|
|
|
"echo Attempt to move datas." "\n"
|
|
|
|
"echo From: %2%" "\n"
|
|
|
|
"echo To: %4%" "\n"
|
|
|
|
"echo Please resolve any conflicts..." "\n"
|
|
|
|
"move /-Y %3% %4%" "\n" // Move all files from %3% to %4%.
|
|
|
|
// /-Y ask what to do when file exists in %4%
|
|
|
|
":REMOVE_OLD_DIR" "\n"
|
|
|
|
"rd %2% || rem" "\n" // Remove empty directory. Sets error flag if fail.
|
|
|
|
"IF ERRORLEVEL 145 (" "\n" // Directory not empty
|
|
|
|
"echo Directory %2% is not empty." "\n"
|
|
|
|
"echo Please move rest of files manually now." "\n"
|
|
|
|
"pause" "\n" // Press any key to continue...
|
|
|
|
"goto REMOVE_OLD_DIR" "\n"
|
|
|
|
")" "\n"
|
|
|
|
"echo Game data updated succefully." "\n"
|
|
|
|
"echo Please update your shortcuts." "\n"
|
|
|
|
"echo Press any key to start a game . . ." "\n"
|
|
|
|
"pause > nul" "\n"
|
|
|
|
"%5%" "\n"
|
|
|
|
"del \"%%~f0\"&exit" "\n" // Script deletes itself
|
|
|
|
;
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
const auto startGameString =
|
|
|
|
bfs::equivalent(currentPath, from) ?
|
|
|
|
(boost::format("start \"\" %1%") % (to / exeName)) : // Start game in new path.
|
|
|
|
(boost::format("start \"\" /D %1% %2%") % currentPath % (to / exeName)); // Start game in 'currentPath"
|
|
|
|
|
|
|
|
const bfs::path bathFilename = to / "_temp.bat";
|
|
|
|
bfs::ofstream bathFile(bathFilename, bfs::ofstream::trunc | bfs::ofstream::out);
|
|
|
|
if (!bathFile.is_open())
|
|
|
|
return false;
|
|
|
|
bathFile << (boost::format(base) % exeName % from % (from / "*.*") % to % startGameString.str()).str();
|
|
|
|
bathFile.close();
|
|
|
|
|
|
|
|
std::system(("start \"Updating VCMI datas\" /D \"" + to.string() + "\" \"" + bathFilename.string() + '\"').c_str());
|
|
|
|
// start won't block std::system
|
|
|
|
// /D start bat in other directory insteand of current directory.
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-26 15:51:38 +02:00
|
|
|
class VCMIDirsWIN32 final : public IVCMIDirs
|
2013-03-02 21:41:25 +03:00
|
|
|
{
|
2014-08-09 20:54:12 +03:00
|
|
|
public:
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path userDataPath() const override;
|
|
|
|
bfs::path userCachePath() const override;
|
|
|
|
bfs::path userConfigPath() const override;
|
2013-03-02 21:41:25 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
std::vector<bfs::path> dataPaths() const override;
|
2013-03-02 21:41:25 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path clientPath() const override;
|
2022-12-28 17:59:16 +02:00
|
|
|
bfs::path mapEditorPath() const override;
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path serverPath() const override;
|
2013-08-24 23:11:51 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path libraryPath() const override;
|
|
|
|
bfs::path binaryPath() const override;
|
2013-03-02 21:41:25 +03:00
|
|
|
|
2014-08-09 20:54:12 +03:00
|
|
|
std::string libraryName(const std::string& basename) const override;
|
2013-03-02 21:41:25 +03:00
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
void init() override;
|
2014-08-21 23:26:28 +03:00
|
|
|
protected:
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path oldUserDataPath() const;
|
|
|
|
bfs::path oldUserSavePath() const;
|
2014-08-11 00:42:39 +03:00
|
|
|
};
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
void VCMIDirsWIN32::init()
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
2022-11-21 16:16:23 +02:00
|
|
|
std::locale::global(boost::locale::generator().generate("en_US.UTF-8"));
|
2022-11-21 16:58:36 +02:00
|
|
|
boost::filesystem::path::imbue(std::locale());
|
2022-11-21 16:16:23 +02:00
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
// Call base (init dirs)
|
|
|
|
IVCMIDirs::init();
|
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
// Moves one directory (from) contents to another directory (to)
|
|
|
|
// Shows user the "moving file dialog" and ask to resolve conflits.
|
|
|
|
// If necessary updates current directory.
|
|
|
|
auto moveDirIfExists = [](const bfs::path& from, const bfs::path& to) -> bool
|
2014-08-09 18:22:37 +03:00
|
|
|
{
|
2014-08-11 00:42:39 +03:00
|
|
|
if (!bfs::is_directory(from))
|
2014-08-21 23:26:28 +03:00
|
|
|
return true; // Nothing to do here. Flies away.
|
2014-08-11 00:42:39 +03:00
|
|
|
|
|
|
|
if (bfs::is_empty(from))
|
|
|
|
{
|
2014-08-21 23:26:28 +03:00
|
|
|
if (bfs::current_path() == from)
|
|
|
|
bfs::current_path(to);
|
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
bfs::remove(from);
|
2014-08-21 23:26:28 +03:00
|
|
|
return true; // Nothing to do here. Flies away.
|
2014-08-11 00:42:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!bfs::is_directory(to))
|
|
|
|
{
|
|
|
|
// IVCMIDirs::init() should create all destination directories.
|
|
|
|
// TODO: Log fact, that we shouldn't be here.
|
2014-09-08 16:15:36 +03:00
|
|
|
bfs::create_directories(to);
|
2014-08-11 00:42:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Why the hell path strings should be end with double null :/
|
2014-08-11 22:24:31 +03:00
|
|
|
auto makeDoubleNulled = [](const bfs::path& path) -> std::unique_ptr<wchar_t[]>
|
2014-08-11 00:42:39 +03:00
|
|
|
{
|
2014-08-11 22:24:31 +03:00
|
|
|
const std::wstring& pathStr = path.native();
|
|
|
|
std::unique_ptr<wchar_t[]> result(new wchar_t[pathStr.length() + 2]);
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
size_t i = 0;
|
2014-08-11 22:24:31 +03:00
|
|
|
for (const wchar_t ch : pathStr)
|
2014-08-11 00:42:39 +03:00
|
|
|
result[i++] = ch;
|
|
|
|
result[i++] = L'\0';
|
|
|
|
result[i++] = L'\0';
|
|
|
|
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
auto fromDNulled = makeDoubleNulled(from / L"*.*");
|
|
|
|
auto toDNulled = makeDoubleNulled(to);
|
|
|
|
|
|
|
|
SHFILEOPSTRUCTW fileOp;
|
|
|
|
fileOp.hwnd = GetConsoleWindow();
|
|
|
|
fileOp.wFunc = FO_MOVE;
|
|
|
|
fileOp.pFrom = fromDNulled.get();
|
|
|
|
fileOp.pTo = toDNulled.get();
|
|
|
|
fileOp.fFlags = 0;
|
|
|
|
fileOp.hNameMappings = nullptr;
|
|
|
|
fileOp.lpszProgressTitle = nullptr;
|
|
|
|
|
|
|
|
const int errorCode = SHFileOperationW(&fileOp);
|
2014-08-21 23:26:28 +03:00
|
|
|
if (errorCode != 0) // TODO: Log error. User should try to move files.
|
|
|
|
return false;
|
|
|
|
else if (fileOp.fAnyOperationsAborted) // TODO: Log warn. User aborted operation. User should move files.
|
|
|
|
return false;
|
|
|
|
else if (!bfs::is_empty(from)) // TODO: Log warn. Some files not moved. User should try to move files.
|
|
|
|
return false;
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
if (bfs::current_path() == from)
|
|
|
|
bfs::current_path(to);
|
|
|
|
|
|
|
|
// TODO: Log fact that we moved files succefully.
|
|
|
|
bfs::remove(from);
|
|
|
|
return true;
|
|
|
|
};
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
// Retrieves the fully qualified path for the file that contains the specified module.
|
|
|
|
// The module must have been loaded by the current process.
|
|
|
|
// If this parameter is nullptr, retrieves the path of the executable file of the current process.
|
|
|
|
auto getModulePath = [](HMODULE hModule) -> bfs::path
|
|
|
|
{
|
|
|
|
wchar_t exePathW[MAX_PATH];
|
|
|
|
DWORD nSize = GetModuleFileNameW(hModule, exePathW, MAX_PATH);
|
|
|
|
DWORD error = GetLastError();
|
|
|
|
// WARN: Windows XP don't set ERROR_INSUFFICIENT_BUFFER error.
|
|
|
|
if (nSize != 0 && error != ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
return bfs::path(std::wstring(exePathW, nSize));
|
|
|
|
// TODO: Error handling
|
|
|
|
return bfs::path();
|
2014-08-11 00:42:39 +03:00
|
|
|
};
|
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
// Moves one directory contents to another directory
|
|
|
|
// Shows user the "moving file dialog" and ask to resolve conflicts.
|
|
|
|
// It takes into account that 'from' path can contain current executable.
|
|
|
|
// If necessary closes program and starts update script.
|
|
|
|
auto advancedMoveDirIfExists = [getModulePath, moveDirIfExists](const bfs::path& from, const bfs::path& to) -> bool
|
|
|
|
{
|
|
|
|
const bfs::path executablePath = getModulePath(nullptr);
|
|
|
|
|
|
|
|
// VCMI cann't determine executable path.
|
|
|
|
// Use standard way to move directory and exit function.
|
|
|
|
if (executablePath.empty())
|
|
|
|
return moveDirIfExists(from, to);
|
|
|
|
|
|
|
|
const bfs::path executableName = executablePath.filename();
|
|
|
|
|
|
|
|
// Current executabl isn't in 'from' path.
|
|
|
|
// Use standard way to move directory and exit function.
|
|
|
|
if (!bfs::equivalent(executablePath, from / executableName))
|
|
|
|
return moveDirIfExists(from, to);
|
|
|
|
|
|
|
|
// Try standard way to move directory.
|
|
|
|
// I don't know how other systems, but Windows 8.1 allow to move running executable.
|
|
|
|
if (moveDirIfExists(from, to))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Start copying script and exit program.
|
|
|
|
if (StartBatchCopyDataProgram(from, to, executableName))
|
|
|
|
exit(ERROR_SUCCESS);
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
// Everything failed :C
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
moveDirIfExists(oldUserSavePath(), userSavePath());
|
|
|
|
advancedMoveDirIfExists(oldUserDataPath(), userDataPath());
|
2013-03-02 21:41:25 +03:00
|
|
|
}
|
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsWIN32::userDataPath() const
|
2013-03-02 21:41:25 +03:00
|
|
|
{
|
2014-08-11 22:24:31 +03:00
|
|
|
wchar_t profileDir[MAX_PATH];
|
2014-08-09 20:54:12 +03:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
if (SHGetSpecialFolderPathW(nullptr, profileDir, CSIDL_MYDOCUMENTS, FALSE) != FALSE)
|
2017-08-25 07:32:14 +02:00
|
|
|
return bfs::path(profileDir) / "My Games" / "vcmi";
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-21 23:26:28 +03:00
|
|
|
return ".";
|
|
|
|
}
|
|
|
|
|
|
|
|
bfs::path VCMIDirsWIN32::oldUserDataPath() const
|
|
|
|
{
|
|
|
|
wchar_t profileDir[MAX_PATH];
|
2016-01-26 15:51:38 +02:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
if (SHGetSpecialFolderPathW(nullptr, profileDir, CSIDL_PROFILE, FALSE) == FALSE) // WinAPI way failed
|
2014-08-09 18:22:37 +03:00
|
|
|
{
|
2014-08-11 22:24:31 +03:00
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1700
|
|
|
|
wchar_t* buffer;
|
|
|
|
size_t bufferSize;
|
|
|
|
errno_t result = _wdupenv_s(&buffer, &bufferSize, L"userprofile");
|
|
|
|
if (result == 0)
|
|
|
|
{
|
|
|
|
bfs::path result(std::wstring(buffer, bufferSize));
|
|
|
|
free(buffer);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
const char* profileDirA;
|
2016-01-26 15:51:38 +02:00
|
|
|
if ((profileDirA = std::getenv("userprofile"))) // STL way succeed
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(profileDirA) / "vcmi";
|
|
|
|
#endif
|
2014-08-09 20:54:12 +03:00
|
|
|
else
|
|
|
|
return "."; // Every thing failed, return current directory.
|
|
|
|
}
|
|
|
|
else
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(profileDir) / "vcmi";
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-09 20:54:12 +03:00
|
|
|
//return dataPaths()[0] ???;
|
|
|
|
}
|
2014-08-21 23:26:28 +03:00
|
|
|
bfs::path VCMIDirsWIN32::oldUserSavePath() const { return userDataPath() / "Games"; }
|
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsWIN32::userCachePath() const { return userDataPath(); }
|
|
|
|
bfs::path VCMIDirsWIN32::userConfigPath() const { return userDataPath() / "config"; }
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
std::vector<bfs::path> VCMIDirsWIN32::dataPaths() const
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
|
|
|
return std::vector<bfs::path>(1, bfs::path("."));
|
|
|
|
}
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsWIN32::clientPath() const { return binaryPath() / "VCMI_client.exe"; }
|
2022-12-28 17:59:16 +02:00
|
|
|
bfs::path VCMIDirsWIN32::mapEditorPath() const { return binaryPath() / "VCMI_editor.exe"; }
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsWIN32::serverPath() const { return binaryPath() / "VCMI_server.exe"; }
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsWIN32::libraryPath() const { return "."; }
|
|
|
|
bfs::path VCMIDirsWIN32::binaryPath() const { return "."; }
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
std::string VCMIDirsWIN32::libraryName(const std::string& basename) const { return basename + ".dll"; }
|
2014-08-11 00:42:39 +03:00
|
|
|
#elif defined(VCMI_UNIX)
|
2014-08-11 22:24:31 +03:00
|
|
|
class IVCMIDirsUNIX : public IVCMIDirs
|
2013-03-02 21:41:25 +03:00
|
|
|
{
|
2014-08-09 20:54:12 +03:00
|
|
|
public:
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path clientPath() const override;
|
2022-12-28 17:59:16 +02:00
|
|
|
bfs::path mapEditorPath() const override;
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path serverPath() const override;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2021-03-02 05:23:00 +02:00
|
|
|
virtual bool developmentMode() const;
|
2014-08-09 20:54:12 +03:00
|
|
|
};
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2017-08-25 07:32:14 +02:00
|
|
|
bool IVCMIDirsUNIX::developmentMode() const
|
|
|
|
{
|
|
|
|
// We want to be able to run VCMI from single directory. E.g to run from build output directory
|
|
|
|
return bfs::exists("AI") && bfs::exists("config") && bfs::exists("Mods") && bfs::exists("vcmiserver") && bfs::exists("vcmiclient");
|
|
|
|
}
|
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path IVCMIDirsUNIX::clientPath() const { return binaryPath() / "vcmiclient"; }
|
2022-12-28 17:59:16 +02:00
|
|
|
bfs::path IVCMIDirsUNIX::mapEditorPath() const { return binaryPath() / "vcmieditor"; }
|
2014-08-26 16:29:56 +03:00
|
|
|
bfs::path IVCMIDirsUNIX::serverPath() const { return binaryPath() / "vcmiserver"; }
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 00:42:39 +03:00
|
|
|
#ifdef VCMI_APPLE
|
2021-03-02 05:23:00 +02:00
|
|
|
class VCMIDirsApple : public IVCMIDirsUNIX
|
|
|
|
{
|
2022-08-15 15:31:58 +02:00
|
|
|
public:
|
|
|
|
bfs::path userConfigPath() const override;
|
2021-03-02 05:23:00 +02:00
|
|
|
|
2022-08-15 15:31:58 +02:00
|
|
|
std::string libraryName(const std::string& basename) const override;
|
2021-03-02 05:23:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
bfs::path VCMIDirsApple::userConfigPath() const { return userDataPath() / "config"; }
|
|
|
|
|
|
|
|
std::string VCMIDirsApple::libraryName(const std::string& basename) const { return "lib" + basename + ".dylib"; }
|
|
|
|
|
|
|
|
#ifdef VCMI_IOS
|
|
|
|
class VCMIDirsIOS final : public VCMIDirsApple
|
|
|
|
{
|
2022-08-15 15:31:58 +02:00
|
|
|
public:
|
|
|
|
bfs::path userDataPath() const override;
|
|
|
|
bfs::path userCachePath() const override;
|
|
|
|
bfs::path userLogsPath() const override;
|
2021-03-02 05:23:00 +02:00
|
|
|
|
2022-08-15 15:31:58 +02:00
|
|
|
std::vector<bfs::path> dataPaths() const override;
|
2021-03-02 05:23:00 +02:00
|
|
|
|
2022-08-15 15:31:58 +02:00
|
|
|
bfs::path libraryPath() const override;
|
2022-10-01 11:36:48 +02:00
|
|
|
bfs::path fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const override;
|
2022-08-15 15:31:58 +02:00
|
|
|
bfs::path binaryPath() const override;
|
2021-03-02 05:23:00 +02:00
|
|
|
};
|
|
|
|
|
2022-08-15 15:29:11 +02:00
|
|
|
bfs::path VCMIDirsIOS::userDataPath() const { return {iOS_utils::documentsPath()}; }
|
|
|
|
bfs::path VCMIDirsIOS::userCachePath() const { return {iOS_utils::cachesPath()}; }
|
|
|
|
bfs::path VCMIDirsIOS::userLogsPath() const { return {iOS_utils::documentsPath()}; }
|
2021-03-02 05:23:00 +02:00
|
|
|
|
2021-03-07 16:21:32 +02:00
|
|
|
std::vector<bfs::path> VCMIDirsIOS::dataPaths() const
|
|
|
|
{
|
2022-08-15 15:31:58 +02:00
|
|
|
std::vector<bfs::path> paths;
|
|
|
|
paths.reserve(4);
|
2021-03-07 16:21:32 +02:00
|
|
|
#ifdef VCMI_IOS_SIM
|
2022-08-15 15:31:58 +02:00
|
|
|
paths.emplace_back(iOS_utils::hostApplicationSupportPath());
|
2021-03-07 16:21:32 +02:00
|
|
|
#endif
|
2022-08-15 15:31:58 +02:00
|
|
|
paths.emplace_back(userDataPath());
|
|
|
|
paths.emplace_back(iOS_utils::documentsPath());
|
|
|
|
paths.emplace_back(binaryPath());
|
|
|
|
return paths;
|
2021-03-07 16:21:32 +02:00
|
|
|
}
|
2021-03-02 05:23:00 +02:00
|
|
|
|
2022-10-01 11:36:48 +02:00
|
|
|
bfs::path VCMIDirsIOS::fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const
|
|
|
|
{
|
|
|
|
// iOS has flat libs directory structure
|
|
|
|
return libraryPath() / libraryName(baseLibName);
|
|
|
|
}
|
|
|
|
|
2022-08-15 15:29:11 +02:00
|
|
|
bfs::path VCMIDirsIOS::libraryPath() const { return {iOS_utils::frameworksPath()}; }
|
|
|
|
bfs::path VCMIDirsIOS::binaryPath() const { return {iOS_utils::bundlePath()}; }
|
2021-03-02 05:23:00 +02:00
|
|
|
#elif defined(VCMI_MAC)
|
|
|
|
class VCMIDirsOSX final : public VCMIDirsApple
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
2022-08-15 15:31:58 +02:00
|
|
|
public:
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path userDataPath() const override;
|
|
|
|
bfs::path userCachePath() const override;
|
|
|
|
bfs::path userLogsPath() const override;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
std::vector<bfs::path> dataPaths() const override;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path libraryPath() const override;
|
|
|
|
bfs::path binaryPath() const override;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2022-08-15 15:31:58 +02:00
|
|
|
void init() override;
|
2014-08-11 00:42:39 +03:00
|
|
|
};
|
2013-03-02 21:41:25 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
void VCMIDirsOSX::init()
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
2014-08-11 00:42:39 +03:00
|
|
|
// Call base (init dirs)
|
2014-08-11 22:24:31 +03:00
|
|
|
IVCMIDirsUNIX::init();
|
2014-08-11 00:42:39 +03:00
|
|
|
|
|
|
|
auto moveDirIfExists = [](const bfs::path& from, const bfs::path& to)
|
2014-08-09 18:22:37 +03:00
|
|
|
{
|
2014-08-11 00:42:39 +03:00
|
|
|
if (!bfs::is_directory(from))
|
|
|
|
return; // Nothing to do here. Flies away.
|
|
|
|
|
|
|
|
if (bfs::is_empty(from))
|
|
|
|
{
|
|
|
|
bfs::remove(from);
|
|
|
|
return; // Nothing to do here. Flies away.
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bfs::is_directory(to))
|
|
|
|
{
|
|
|
|
// IVCMIDirs::init() should create all destination directories.
|
|
|
|
// TODO: Log fact, that we shouldn't be here.
|
2014-09-08 16:15:36 +03:00
|
|
|
bfs::create_directories(to);
|
2014-08-11 00:42:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for (bfs::directory_iterator file(from); file != bfs::directory_iterator(); ++file)
|
|
|
|
{
|
2022-11-24 22:15:46 +02:00
|
|
|
const bfs::path& srcFilePath = file->path();
|
|
|
|
const bfs::path dstFilePath = to / srcFilePath.filename();
|
2014-08-11 00:42:39 +03:00
|
|
|
|
|
|
|
// TODO: Aplication should ask user what to do when file exists:
|
|
|
|
// replace/ignore/stop process/replace all/ignore all
|
2022-11-24 22:15:46 +02:00
|
|
|
if (!bfs::exists(dstFilePath))
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::rename(srcFilePath, dstFilePath);
|
2014-08-11 00:42:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!bfs::is_empty(from)); // TODO: Log warn. Some files not moved. User should try to move files.
|
|
|
|
else
|
|
|
|
bfs::remove(from);
|
|
|
|
};
|
|
|
|
|
|
|
|
moveDirIfExists(userDataPath() / "Games", userSavePath());
|
2013-03-02 21:41:25 +03:00
|
|
|
}
|
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsOSX::userDataPath() const
|
2013-03-02 21:41:25 +03:00
|
|
|
{
|
2014-08-09 20:54:12 +03:00
|
|
|
// This is Cocoa code that should be normally used to get path to Application Support folder but can't use it here for now...
|
|
|
|
// NSArray* urls = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
|
|
|
|
// UserPath = path([urls[0] path] + "/vcmi").string();
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-09 20:54:12 +03:00
|
|
|
// ...so here goes a bit of hardcode instead
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
const char* homeDir = getenv("HOME"); // Should be std::getenv?
|
|
|
|
if (homeDir == nullptr)
|
|
|
|
homeDir = ".";
|
|
|
|
return bfs::path(homeDir) / "Library" / "Application Support" / "vcmi";
|
2014-08-09 20:54:12 +03:00
|
|
|
}
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsOSX::userCachePath() const { return userDataPath(); }
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2022-09-17 15:57:21 +02:00
|
|
|
bfs::path VCMIDirsOSX::userLogsPath() const
|
|
|
|
{
|
|
|
|
// TODO: use proper objc code from Foundation framework
|
|
|
|
if(const auto homeDir = std::getenv("HOME"))
|
|
|
|
return bfs::path{homeDir} / "Library" / "Logs" / "vcmi";
|
|
|
|
return IVCMIDirsUNIX::userLogsPath();
|
|
|
|
}
|
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
std::vector<bfs::path> VCMIDirsOSX::dataPaths() const
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
2017-08-13 16:20:57 +02:00
|
|
|
std::vector<bfs::path> ret;
|
|
|
|
//FIXME: need some proper codepath for detecting running from build output directory
|
2017-08-25 07:32:14 +02:00
|
|
|
if(developmentMode())
|
2017-08-13 16:20:57 +02:00
|
|
|
{
|
|
|
|
ret.push_back(".");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret.push_back("../Resources/Data");
|
|
|
|
}
|
|
|
|
return ret;
|
2014-08-09 20:54:12 +03:00
|
|
|
}
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-11 22:24:31 +03:00
|
|
|
bfs::path VCMIDirsOSX::libraryPath() const { return "."; }
|
|
|
|
bfs::path VCMIDirsOSX::binaryPath() const { return "."; }
|
2021-03-02 05:23:00 +02:00
|
|
|
#endif // VCMI_IOS, VCMI_MAC
|
2023-02-25 09:38:05 +02:00
|
|
|
|
|
|
|
#elif defined(VCMI_ANDROID)
|
|
|
|
class VCMIDirsAndroid : public IVCMIDirsUNIX
|
|
|
|
{
|
|
|
|
std::string basePath;
|
|
|
|
std::string internalPath;
|
|
|
|
std::string nativePath;
|
|
|
|
public:
|
|
|
|
std::string libraryName(const std::string & basename) const override;
|
|
|
|
bfs::path fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const override;
|
|
|
|
bfs::path binaryPath() const override;
|
|
|
|
bfs::path libraryPath() const override;
|
|
|
|
bfs::path userDataPath() const override;
|
|
|
|
bfs::path userCachePath() const override;
|
|
|
|
bfs::path userConfigPath() const override;
|
|
|
|
|
|
|
|
std::vector<bfs::path> dataPaths() const override;
|
|
|
|
|
|
|
|
void init() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::string VCMIDirsAndroid::libraryName(const std::string & basename) const { return "lib" + basename + ".so"; }
|
|
|
|
bfs::path VCMIDirsAndroid::binaryPath() const { return "."; }
|
|
|
|
bfs::path VCMIDirsAndroid::libraryPath() const { return nativePath; }
|
|
|
|
bfs::path VCMIDirsAndroid::userDataPath() const { return basePath; }
|
|
|
|
bfs::path VCMIDirsAndroid::userCachePath() const { return userDataPath() / "cache"; }
|
|
|
|
bfs::path VCMIDirsAndroid::userConfigPath() const { return userDataPath() / "config"; }
|
|
|
|
|
|
|
|
bfs::path VCMIDirsAndroid::fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const
|
|
|
|
{
|
|
|
|
// ignore passed folder (all libraries in android are dumped into a single folder)
|
|
|
|
return libraryPath() / libraryName(baseLibName);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<bfs::path> VCMIDirsAndroid::dataPaths() const
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
internalPath,
|
|
|
|
userDataPath(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCMIDirsAndroid::init()
|
|
|
|
{
|
|
|
|
// asks java code to retrieve needed paths from environment
|
|
|
|
CAndroidVMHelper envHelper;
|
|
|
|
basePath = envHelper.callStaticStringMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "dataRoot");
|
|
|
|
internalPath = envHelper.callStaticStringMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "internalDataRoot");
|
|
|
|
nativePath = envHelper.callStaticStringMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "nativePath");
|
|
|
|
IVCMIDirsUNIX::init();
|
|
|
|
}
|
2014-11-17 13:19:29 +02:00
|
|
|
#elif defined(VCMI_XDG)
|
|
|
|
class VCMIDirsXDG : public IVCMIDirsUNIX
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
|
|
|
public:
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path userDataPath() const override;
|
|
|
|
bfs::path userCachePath() const override;
|
|
|
|
bfs::path userConfigPath() const override;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
std::vector<bfs::path> dataPaths() const override;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2022-11-24 22:15:46 +02:00
|
|
|
bfs::path libraryPath() const override;
|
|
|
|
bfs::path binaryPath() const override;
|
2014-08-09 20:54:12 +03:00
|
|
|
|
|
|
|
std::string libraryName(const std::string& basename) const override;
|
|
|
|
};
|
2014-03-04 17:51:10 +03:00
|
|
|
|
2014-11-17 13:19:29 +02:00
|
|
|
bfs::path VCMIDirsXDG::userDataPath() const
|
2014-03-04 17:51:10 +03:00
|
|
|
{
|
2014-08-09 20:54:12 +03:00
|
|
|
// $XDG_DATA_HOME, default: $HOME/.local/share
|
2014-08-11 22:24:31 +03:00
|
|
|
const char* homeDir;
|
2017-08-25 07:32:14 +02:00
|
|
|
if((homeDir = getenv("XDG_DATA_HOME")))
|
|
|
|
return bfs::path(homeDir) / "vcmi";
|
|
|
|
else if((homeDir = getenv("HOME")))
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(homeDir) / ".local" / "share" / "vcmi";
|
2014-08-09 20:54:12 +03:00
|
|
|
else
|
|
|
|
return ".";
|
|
|
|
}
|
2014-11-17 13:19:29 +02:00
|
|
|
bfs::path VCMIDirsXDG::userCachePath() const
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
|
|
|
// $XDG_CACHE_HOME, default: $HOME/.cache
|
2017-08-25 07:32:14 +02:00
|
|
|
const char * tempResult;
|
2014-08-26 16:29:56 +03:00
|
|
|
if ((tempResult = getenv("XDG_CACHE_HOME")))
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(tempResult) / "vcmi";
|
2014-08-26 16:29:56 +03:00
|
|
|
else if ((tempResult = getenv("HOME")))
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(tempResult) / ".cache" / "vcmi";
|
2014-08-09 20:54:12 +03:00
|
|
|
else
|
|
|
|
return ".";
|
|
|
|
}
|
2014-11-17 13:19:29 +02:00
|
|
|
bfs::path VCMIDirsXDG::userConfigPath() const
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
|
|
|
// $XDG_CONFIG_HOME, default: $HOME/.config
|
2017-08-25 07:32:14 +02:00
|
|
|
const char * tempResult;
|
2014-08-26 16:29:56 +03:00
|
|
|
if ((tempResult = getenv("XDG_CONFIG_HOME")))
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(tempResult) / "vcmi";
|
2014-08-26 16:29:56 +03:00
|
|
|
else if ((tempResult = getenv("HOME")))
|
2014-08-11 22:24:31 +03:00
|
|
|
return bfs::path(tempResult) / ".config" / "vcmi";
|
2014-08-09 20:54:12 +03:00
|
|
|
else
|
|
|
|
return ".";
|
|
|
|
}
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-11-17 13:19:29 +02:00
|
|
|
std::vector<bfs::path> VCMIDirsXDG::dataPaths() const
|
2014-08-09 20:54:12 +03:00
|
|
|
{
|
|
|
|
// $XDG_DATA_DIRS, default: /usr/local/share/:/usr/share/
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-09 20:54:12 +03:00
|
|
|
// construct list in reverse.
|
|
|
|
// in specification first directory has highest priority
|
|
|
|
// in vcmi fs last directory has highest priority
|
|
|
|
std::vector<bfs::path> ret;
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2017-08-25 07:32:14 +02:00
|
|
|
if(developmentMode())
|
2017-08-13 16:20:57 +02:00
|
|
|
{
|
|
|
|
//For now we'll disable usage of system directories when VCMI running from bin directory
|
|
|
|
ret.push_back(".");
|
|
|
|
}
|
2014-08-09 20:54:12 +03:00
|
|
|
else
|
|
|
|
{
|
2017-08-25 07:32:14 +02:00
|
|
|
ret.push_back(M_DATA_DIR);
|
|
|
|
const char * tempResult;
|
|
|
|
if((tempResult = getenv("XDG_DATA_DIRS")) != nullptr)
|
|
|
|
{
|
|
|
|
std::string dataDirsEnv = tempResult;
|
|
|
|
std::vector<std::string> dataDirs;
|
|
|
|
boost::split(dataDirs, dataDirsEnv, boost::is_any_of(":"));
|
|
|
|
for (auto & entry : boost::adaptors::reverse(dataDirs))
|
|
|
|
ret.push_back(bfs::path(entry) / "vcmi");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret.push_back(bfs::path("/usr/share") / "vcmi");
|
|
|
|
ret.push_back(bfs::path("/usr/local/share") / "vcmi");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Debian and other distributions might want to use it while it's not part of XDG
|
|
|
|
ret.push_back(bfs::path("/usr/share/games") / "vcmi");
|
2014-08-09 20:54:12 +03:00
|
|
|
}
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-08-09 20:54:12 +03:00
|
|
|
return ret;
|
|
|
|
}
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2017-08-25 07:32:14 +02:00
|
|
|
bfs::path VCMIDirsXDG::libraryPath() const
|
|
|
|
{
|
|
|
|
if(developmentMode())
|
|
|
|
return ".";
|
|
|
|
else
|
|
|
|
return M_LIB_DIR;
|
|
|
|
}
|
|
|
|
|
|
|
|
bfs::path VCMIDirsXDG::binaryPath() const
|
|
|
|
{
|
|
|
|
if(developmentMode())
|
|
|
|
return ".";
|
|
|
|
else
|
|
|
|
return M_BIN_DIR;
|
|
|
|
}
|
2014-08-09 18:22:37 +03:00
|
|
|
|
2014-11-17 13:19:29 +02:00
|
|
|
std::string VCMIDirsXDG::libraryName(const std::string& basename) const { return "lib" + basename + ".so"; }
|
2017-05-25 19:57:20 +02:00
|
|
|
|
2023-02-25 09:38:05 +02:00
|
|
|
#endif // VCMI_APPLE, VCMI_ANDROID, VCMI_XDG
|
2014-08-11 00:42:39 +03:00
|
|
|
#endif // VCMI_WINDOWS, VCMI_UNIX
|
|
|
|
|
|
|
|
// Getters for interfaces are separated for clarity.
|
|
|
|
namespace VCMIDirs
|
|
|
|
{
|
|
|
|
const IVCMIDirs& get()
|
|
|
|
{
|
|
|
|
#ifdef VCMI_WINDOWS
|
2014-08-11 22:24:31 +03:00
|
|
|
static VCMIDirsWIN32 singleton;
|
2014-08-11 00:42:39 +03:00
|
|
|
#elif defined(VCMI_ANDROID)
|
2014-08-11 22:24:31 +03:00
|
|
|
static VCMIDirsAndroid singleton;
|
2014-11-17 13:19:29 +02:00
|
|
|
#elif defined(VCMI_XDG)
|
|
|
|
static VCMIDirsXDG singleton;
|
2021-03-02 05:23:00 +02:00
|
|
|
#elif defined(VCMI_MAC)
|
2014-08-11 22:24:31 +03:00
|
|
|
static VCMIDirsOSX singleton;
|
2021-03-02 05:23:00 +02:00
|
|
|
#elif defined(VCMI_IOS)
|
|
|
|
static VCMIDirsIOS singleton;
|
|
|
|
#endif
|
2017-05-25 19:57:20 +02:00
|
|
|
|
2023-02-12 12:20:26 +02:00
|
|
|
static std::once_flag flag;
|
|
|
|
std::call_once(flag, [] { singleton.init(); });
|
2014-08-11 00:42:39 +03:00
|
|
|
return singleton;
|
|
|
|
}
|
2014-09-11 16:53:25 +03:00
|
|
|
}
|
2017-05-25 19:57:20 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_END
|