1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Revert VCMIDirs to fix the build

This commit is contained in:
nordsoft 2022-12-17 21:09:05 +04:00 committed by Nordsoft91
parent 4c15531a05
commit 34b81e8838

View File

@ -15,26 +15,6 @@
#include "iOS_utils.h"
#endif
#ifdef VCMI_ANDROID
#include "CAndroidVMHelper.h"
#endif
#ifdef VCMI_WINDOWS
#ifdef __MINGW32__
#define _WIN32_IE 0x0500
#ifndef CSIDL_MYDOCUMENTS
#define CSIDL_MYDOCUMENTS CSIDL_PERSONAL
#endif
#endif // __MINGW32__
#include <windows.h>
#include <shlobj.h>
#include <shellapi.h>
#endif
VCMI_LIB_NAMESPACE_BEGIN
namespace bfs = boost::filesystem;
@ -66,8 +46,8 @@ std::string IVCMIDirs::genHelpString() const
" user cache: " + userCachePath().string() + "\n"
" user config: " + userConfigPath().string() + "\n"
" user logs: " + userLogsPath().string() + "\n"
" user saves: " + userSavePath().string() + "\n"
" user extracted: " + userExtractedPath().string() + "\n";
" user saves: " + userSavePath().string() + "\n";
" user extracted: " + userExtractedPath().string() + "\n"; // Should end without new-line?
}
void IVCMIDirs::init()
@ -80,9 +60,25 @@ void IVCMIDirs::init()
bfs::create_directories(userSavePath());
}
#ifdef VCMI_ANDROID
#include "CAndroidVMHelper.h"
#endif
#ifdef VCMI_WINDOWS
#ifdef __MINGW32__
#define _WIN32_IE 0x0500
#ifndef CSIDL_MYDOCUMENTS
#define CSIDL_MYDOCUMENTS CSIDL_PERSONAL
#endif
#endif // __MINGW32__
#include <windows.h>
#include <shlobj.h>
#include <shellapi.h>
// Generates script file named _temp.bat in 'to' directory and runs it
// Script will:
// - Wait util 'exeName' ends.
@ -365,20 +361,13 @@ class IVCMIDirsUNIX : public IVCMIDirs
bfs::path clientPath() const override;
bfs::path serverPath() const override;
virtual bool developmentModeData() const;
virtual bool developmentModeBinaries() const;
virtual bool developmentMode() const;
};
bool IVCMIDirsUNIX::developmentModeData() const
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("config") && bfs::exists("Mods") && bfs::exists("../CMakeCache.txt");
}
bool IVCMIDirsUNIX::developmentModeBinaries() 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("../CMakeCache.txt");
return bfs::exists("AI") && bfs::exists("config") && bfs::exists("Mods") && bfs::exists("vcmiserver") && bfs::exists("vcmiclient");
}
bfs::path IVCMIDirsUNIX::clientPath() const { return binaryPath() / "vcmiclient"; }
@ -522,7 +511,7 @@ std::vector<bfs::path> VCMIDirsOSX::dataPaths() const
{
std::vector<bfs::path> ret;
//FIXME: need some proper codepath for detecting running from build output directory
if(developmentModeData())
if(developmentMode())
{
ret.push_back(".");
}
@ -595,7 +584,7 @@ std::vector<bfs::path> VCMIDirsXDG::dataPaths() const
// in vcmi fs last directory has highest priority
std::vector<bfs::path> ret;
if(developmentModeData())
if(developmentMode())
{
//For now we'll disable usage of system directories when VCMI running from bin directory
ret.push_back(".");
@ -627,7 +616,7 @@ std::vector<bfs::path> VCMIDirsXDG::dataPaths() const
bfs::path VCMIDirsXDG::libraryPath() const
{
if(developmentModeBinaries())
if(developmentMode())
return ".";
else
return M_LIB_DIR;
@ -635,7 +624,7 @@ bfs::path VCMIDirsXDG::libraryPath() const
bfs::path VCMIDirsXDG::binaryPath() const
{
if(developmentModeBinaries())
if(developmentMode())
return ".";
else
return M_BIN_DIR;