diff --git a/CMake/Packaging-2.cmake b/CMake/Packaging-2.cmake
index 38fcc59f3..a29635eac 100644
--- a/CMake/Packaging-2.cmake
+++ b/CMake/Packaging-2.cmake
@@ -24,6 +24,5 @@ if (CPACK_GENERATOR MATCHES "Bundle")
set(CPACK_BUNDLE_NAME "soh")
set(CPACK_BUNDLE_PLIST "macosx/Info.plist")
set(CPACK_BUNDLE_ICON "macosx/soh.icns")
- set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/soh-macos.sh")
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bdaf1de9..edbe5b44b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -272,9 +272,12 @@ install(DIRECTORY ${CMAKE_BINARY_DIR}/assets
PERMISSIONS ${PROGRAM_PERMISSIONS_EXECUTE}
)
+# Rename the installed soh binary to drop the macos suffix
+INSTALL(CODE "FILE(RENAME \${CMAKE_INSTALL_PREFIX}/../MacOS/soh-macos \${CMAKE_INSTALL_PREFIX}/../MacOS/soh)")
+
install(CODE "
include(BundleUtilities)
- fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\")
+ fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/../MacOS/soh\" \"\" \"${dirs}\")
")
endif()
diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt
index 8218588e4..b4ee6ed7f 100644
--- a/soh/CMakeLists.txt
+++ b/soh/CMakeLists.txt
@@ -702,7 +702,7 @@ else()
)
endif()
-if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
+if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|NintendoSwitch|CafeOS")
INSTALL(TARGETS soh DESTINATION . COMPONENT ship)
endif()
@@ -720,7 +720,7 @@ execute_process(COMMAND ${CURL} -sSfL https://raw.githubusercontent.com/gabomdq/
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/macosx/Info.plist.in ${CMAKE_BINARY_DIR}/macosx/Info.plist @ONLY)
-configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/macosx/soh-macos.sh.in ${CMAKE_BINARY_DIR}/macosx/soh-macos.sh @ONLY)
+INSTALL(TARGETS soh DESTINATION ../MacOS COMPONENT ship)
INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION ../MacOS COMPONENT ship)
INSTALL(FILES ${CMAKE_BINARY_DIR}/soh/soh.otr DESTINATION ../Resources COMPONENT ship)
elseif(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "NintendoSwitch|CafeOS")
diff --git a/soh/macosx/Info.plist.in b/soh/macosx/Info.plist.in
index 61316a18f..350c857f6 100644
--- a/soh/macosx/Info.plist.in
+++ b/soh/macosx/Info.plist.in
@@ -33,6 +33,11 @@
public.app-category.games
LSMinimumSystemVersion
10.15
+ LSEnvironment
+
+ SHIP_HOME
+ ~/Library/Application Support/com.shipofharkinian.soh
+
LSArchitecturePriority
arm64
diff --git a/soh/macosx/soh-macos.sh.in b/soh/macosx/soh-macos.sh.in
deleted file mode 100755
index b90bd22e1..000000000
--- a/soh/macosx/soh-macos.sh.in
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-SNAME="$(dirname $0)"
-export SHIP_HOME="$HOME/Library/Application Support/com.shipofharkinian.soh"
-export SNAME
-export RESPATH="${SNAME%/MacOS*}/Resources"
-export LIBPATH="${SNAME%/MacOS*}/Frameworks"
-export DYLD_FALLBACK_LIBRARY_PATH="$LIBPATH"
-
-if [ ! -e "$SHIP_HOME" ]; then mkdir "$SHIP_HOME"; fi
-
-if [ ! -e "$SHIP_HOME"/mods ]; then
- mkdir -p "$SHIP_HOME"/mods
- touch "$SHIP_HOME"/mods/custom_otr_files_go_here.txt
-fi
-
-"$RESPATH"/soh-macos
-
-exit
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index c19b186db..d128c0eba 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -1038,6 +1038,23 @@ bool PathTestCleanup(FILE* tfile) {
return true;
}
+void CheckAndCreateModFolder() {
+ try {
+ std::string modsPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName);
+ if (!std::filesystem::exists(modsPath)) {
+ // Create mods folder relative to app dir
+ modsPath = Ship::Context::GetPathRelativeToAppDirectory("mods", appShortName);
+ std::string filePath = modsPath + "/custom_mod_files_go_here.txt";
+ if (std::filesystem::create_directories(modsPath)) {
+ std::ofstream(filePath).close();
+ }
+ }
+ } catch (std::filesystem::filesystem_error const& ex) {
+ // Couldn't make the folder, continue silently
+ return;
+ }
+}
+
extern "C" void InitOTR() {
#ifdef __SWITCH__
@@ -1083,6 +1100,10 @@ extern "C" void InitOTR() {
}
#endif
+#if not defined(__SWITCH__) && not defined(__WIIU__)
+ CheckAndCreateModFolder();
+#endif
+
CheckSoHOTRVersion(Ship::Context::GetPathRelativeToAppBundle("soh.otr"));
if (!std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) &&