Skip to content

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

C

Fix setting working directory

manongjohne4c3c8ecdae0
diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp
index b925bb763..8b69f167d 100644
--- a/toonz/sources/common/tapptools/tenv.cpp
+++ b/toonz/sources/common/tapptools/tenv.cpp
@@ -184,6 +184,7 @@ public:
void setApplicationFileName(std::string appFileName) {
m_applicationFileName = appFileName;
+ setWorkingDirectory();
}
std::string getApplicationFileName() { return m_applicationFileName; }
std::string getApplicationName() { return m_version.getAppName(); }
@@ -242,7 +243,8 @@ public:
portableStatus = TFileStatus(portableCheck);
m_isPortable = portableStatus.doesExist();
if (m_isPortable)
- m_workingDirectory.append("\\" + getApplicationFileName() + ".app");
+ m_workingDirectory =
+ portableCheck.getParentDir().getQString().toStdString();
}
#endif
}
diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp
index 88d5117f8..8ae73fc4f 100644
--- a/toonz/sources/toonz/main.cpp
+++ b/toonz/sources/toonz/main.cpp
@@ -237,8 +237,6 @@ 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 debug
BOOL consoleAttached = ::AttachConsole(ATTACH_PARENT_PROCESS);
@@ -411,6 +409,8 @@ int main(int argc, char *argv[]) {
}
#endif
+ TEnv::setApplicationFileName(argv[0]);
+
// splash screen
QPixmap splashPixmap = QIcon(":Resources/splash.svg").pixmap(QSize(610, 344));
splashPixmap.setDevicePixelRatio(QApplication::desktop()->devicePixelRatio());