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