Skip to content

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

C

Add Desktop and Documents location in file browser for Linux.

Martin van Zijl9930975e61a4
diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp
index 65012de48..684210fe1 100644
--- a/toonz/sources/toonz/filebrowsermodel.cpp
+++ b/toonz/sources/toonz/filebrowsermodel.cpp
@@ -49,7 +49,13 @@ TFilePath getMyDocumentsPath() {
return TFilePath((const char *)[documentsDirectory
cStringUsingEncoding:NSASCIIStringEncoding]);
#else
- return TFilePath();
+ std::string path(getenv("HOME"));
+ if(path.empty()) return TFilePath();
+ path += "/Documents";
+ QString pathAsQString = QString::fromStdString(path);
+ QDir dir(pathAsQString);
+ if(!dir.exists()) return TFilePath();
+ return TFilePath(path);
#endif
}
@@ -71,7 +77,13 @@ TFilePath getDesktopPath() {
return TFilePath((const char *)[desktopDirectory
cStringUsingEncoding:NSASCIIStringEncoding]);
#else
- return TFilePath();
+ std::string path(getenv("HOME"));
+ if(path.empty()) return TFilePath();
+ path += "/Desktop";
+ QString pathAsQString = QString::fromStdString(path);
+ QDir dir(pathAsQString);
+ if(!dir.exists()) return TFilePath();
+ return TFilePath(path);
#endif
}
}
@@ -1494,4 +1506,4 @@ void DvDirModel::onPreferenceChanged(const QString &prefName) {
if (rootNode)
rootNode->updateSceneFolderNodeVisibility(priority ==
Preferences::ProjectFolderOnly);
-}
\ No newline at end of file
+}