From 9930975e61a4d048b9d6e54ac6726ecd0095a6b2 Mon Sep 17 00:00:00 2001 From: Martin van Zijl Date: Aug 27 2019 17:10:12 +0000 Subject: Add Desktop and Documents location in file browser for Linux. --- diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp index 65012de..684210f 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 +}