Browse Source

Merge pull request #1032 from kambala-decapitator/ios-flat-libs-dir

switch to flat libs directory structure
Andrii Danylchenko 3 years ago
parent
commit
b2ea2eaba6
3 changed files with 17 additions and 3 deletions
  1. 8 2
      CMakeLists.txt
  2. 2 1
      launcher/mainwindow_moc.cpp
  3. 7 0
      lib/VCMIDirs.cpp

+ 8 - 2
CMakeLists.txt

@@ -402,8 +402,14 @@ else()
 	add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
 endif()
 
-set(AI_LIB_DIR "${LIB_DIR}/AI")
-set(SCRIPTING_LIB_DIR "${LIB_DIR}/scripting")
+# iOS has flat libs directory structure
+if(APPLE_IOS)
+	set(AI_LIB_DIR "${LIB_DIR}")
+	set(SCRIPTING_LIB_DIR "${LIB_DIR}")
+else()
+	set(AI_LIB_DIR "${LIB_DIR}/AI")
+	set(SCRIPTING_LIB_DIR "${LIB_DIR}/scripting")
+endif()
 
 #######################################
 #        Add subdirectories           #

+ 2 - 1
launcher/mainwindow_moc.cpp

@@ -92,7 +92,8 @@ MainWindow::MainWindow(QWidget * parent)
 
 	connect(ui->tabSelectList, &QListWidget::currentRowChanged, [this](int i) {
 #ifdef Q_OS_IOS
-		qApp->focusWidget()->clearFocus();
+		if(auto widget = qApp->focusWidget())
+			widget->clearFocus();
 #endif
 		ui->tabListWidget->setCurrentIndex(i);
 	});

+ 7 - 0
lib/VCMIDirs.cpp

@@ -391,6 +391,7 @@ public:
 	std::vector<bfs::path> dataPaths() const override;
 
 	bfs::path libraryPath() const override;
+	bfs::path fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const override;
 	bfs::path binaryPath() const override;
 };
 
@@ -411,6 +412,12 @@ std::vector<bfs::path> VCMIDirsIOS::dataPaths() const
 	return paths;
 }
 
+bfs::path VCMIDirsIOS::fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const
+{
+	// iOS has flat libs directory structure
+	return libraryPath() / libraryName(baseLibName);
+}
+
 bfs::path VCMIDirsIOS::libraryPath() const { return {iOS_utils::frameworksPath()}; }
 bfs::path VCMIDirsIOS::binaryPath() const { return {iOS_utils::bundlePath()}; }
 #elif defined(VCMI_MAC)