Browse Source

simulator reads data from the macOS directory

Andrey Filipenkov 4 years ago
parent
commit
b8fa692bda
2 changed files with 29 additions and 4 deletions
  1. 1 1
      Global.h
  2. 28 3
      lib/VCMIDirs.cpp

+ 1 - 1
Global.h

@@ -68,7 +68,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
 #  define VCMI_UNIX
 #  define VCMI_APPLE
 #  include "TargetConditionals.h"
-#  if TARGET_IPHONE_SIMULATOR
+#  if TARGET_OS_SIMULATOR || TARGET_IPHONE_SIMULATOR
 #    define VCMI_IOS
 #    define VCMI_IOS_SIM
 #  elif TARGET_OS_IPHONE

+ 28 - 3
lib/VCMIDirs.cpp

@@ -400,11 +400,36 @@ bfs::path VCMIDirsIOS::userDataPath() const { return {ios_documentsPath()}; }
 bfs::path VCMIDirsIOS::userCachePath() const { return {ios_cachesPath()}; }
 bfs::path VCMIDirsIOS::userLogsPath() const { return {ios_documentsPath()}; }
 
-std::vector<bfs::path> VCMIDirsIOS::dataPaths() const { return {binaryPath(), userDataPath()}; }
+std::vector<bfs::path> VCMIDirsIOS::dataPaths() const
+{
+    return {
+#ifdef VCMI_IOS_SIM
+        // fixme ios
+        {"/Users/kambala/Library/Application Support/vcmi"},
+#endif
+        binaryPath(),
+        userDataPath(),
+    };
+}
 
-bfs::path VCMIDirsIOS::libraryPath() const { return {ios_frameworksPath()}; }
+bfs::path VCMIDirsIOS::libraryPath() const
+{
+#ifdef VCMI_IOS_SIM
+// fixme ios
+    return {"/Users/kambala/dev/vcmi/build-sim64/bin/Debug"};
+#else
+    return {ios_frameworksPath()};
+#endif
+}
 // todo ios: place AI libs in subdir?
-boost::filesystem::path VCMIDirsIOS::fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const { return libraryPath() / libraryName(baseLibName); }
+boost::filesystem::path VCMIDirsIOS::fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const
+{
+#ifdef VCMI_IOS_SIM
+    return VCMIDirsApple::fullLibraryPath(desiredFolder, baseLibName);
+#else
+    return libraryPath() / libraryName(baseLibName);
+#endif
+}
 bfs::path VCMIDirsIOS::binaryPath() const { return {ios_bundlePath()}; }
 bfs::path VCMIDirsIOS::serverPath() const { return clientPath(); }