OpenToonz - An open-source full-featured 2D animation creation software
C
Fix app rename causing not to work
manongjohnfba66295ba3f
diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cppindex 784bbdaa2..1880a563c 100644--- a/toonz/sources/common/tapptools/tenv.cpp+++ b/toonz/sources/common/tapptools/tenv.cpp@@ -41,6 +41,7 @@ const std::map<std::string, std::string> systemPathMap{class EnvGlobals { // singletonToonzVersion m_version;+ std::string m_applicationFileName; // May differ from application namestd::string m_applicationVersion;std::string m_applicationFullName;std::string m_moduleName;@@ -76,7 +77,7 @@ public:QString settingsPath;#ifdef MACOSX- settingsPath = QString::fromStdString(getApplicationName()) ++ settingsPath = QString::fromStdString(getApplicationFileName()) +QString(".app") +QString("/Contents/Resources/SystemVar.ini");#else /* Generic Unix */@@ -181,6 +182,10 @@ public:updateEnvFile();}+ void setApplicationFileName(std::string appFileName) {+ m_applicationFileName = appFileName;+ }+ std::string getApplicationFileName() { return m_applicationFileName; }std::string getApplicationName() { return m_version.getAppName(); }std::string getApplicationVersion() { return m_applicationVersion; }std::string getApplicationVersionWithoutRevision() {@@ -231,12 +236,13 @@ public:// 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\\");+ portableCheck =+ TFilePath(m_workingDirectory + "\\" + getApplicationFileName() ++ ".app\\portablestuff\\");portableStatus = TFileStatus(portableCheck);m_isPortable = portableStatus.doesExist();if (m_isPortable)- m_workingDirectory.append("\\" + getApplicationName() + ".app");+ m_workingDirectory.append("\\" + getApplicationFileName() + ".app");}#endif}@@ -492,6 +498,15 @@ void Variable::assignValue(std::string value) {//===================================================================+void TEnv::setApplicationFileName(std::string appFileName) {+ TFilePath fp(appFileName);+ EnvGlobals::instance()->setApplicationFileName(fp.getName());+}++std::string TEnv::getApplicationFileName() {+ return EnvGlobals::instance()->getApplicationFileName();+}+std::string TEnv::getApplicationName() {return EnvGlobals::instance()->getApplicationName();}diff --git a/toonz/sources/include/tenv.h b/toonz/sources/include/tenv.hindex dc793e138..a9130b5d7 100644--- a/toonz/sources/include/tenv.h+++ b/toonz/sources/include/tenv.h@@ -93,6 +93,12 @@ public:DVAPI std::string getApplicationName();DVAPI std::string getApplicationVersion();+// This are for the case where the file name of application changes and doesn't+// match actual application name and we want to keep both. We will need that for+// some stuff+DVAPI void setApplicationFileName(std::string appFileName);+DVAPI std::string getApplicationFileName();+DVAPI bool getIsPortable();// es.: TEnv::setModuleFullName("Toonz 5.0.1 Harlequin");diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cppindex 8fb85fe8f..88d5117f8 100644--- a/toonz/sources/toonz/main.cpp+++ b/toonz/sources/toonz/main.cpp@@ -237,6 +237,8 @@ project->setUseScenePath(TProject::Extras, false);//-----------------------------------------------------------------------------int main(int argc, char *argv[]) {+ TEnv::setApplicationFileName(argv[0]);+#ifdef Q_OS_WIN// Enable standard input/output on Windows Platform for debugBOOL consoleAttached = ::AttachConsole(ATTACH_PARENT_PROCESS);