Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix macOS portable detection

manongjohn65b0ffe2604f
diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp
index 05528cbd0..784bbdaa2 100644
--- a/toonz/sources/common/tapptools/tenv.cpp
+++ b/toonz/sources/common/tapptools/tenv.cpp
@@ -223,6 +223,22 @@ public:
TFilePath(m_workingDirectory + "\\portablestuff\\");
TFileStatus portableStatus(portableCheck);
m_isPortable = portableStatus.doesExist();
+
+#ifdef MACOSX
+ // macOS 10.12 (Sierra) translocates applications before running them
+ // depending on how it was installed. This separates the app from the
+ // portablestuff folder and we don't know where it is so we stop treating it
+ // as a portable. Placing portablestuff inside OpenToonz.app will keep
+ // everything together when it translocates.
+ if (!m_isPortable) {
+ portableCheck = TFilePath(m_workingDirectory + "\\" +
+ getApplicationName() + ".app\\portablestuff\\");
+ portableStatus = TFileStatus(portableCheck);
+ m_isPortable = portableStatus.doesExist();
+ if (m_isPortable)
+ m_workingDirectory.append("\\" + getApplicationName() + ".app");
+ }
+#endif
}
std::string getWorkingDirectory() { return m_workingDirectory; }