Skip to content

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

C

Deal Linux Desktop Path

Abel Youc8eaa69f7404
diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp
index 8df018d92..1c145ce64 100644
--- a/toonz/sources/toonz/filebrowsermodel.cpp
+++ b/toonz/sources/toonz/filebrowsermodel.cpp
@@ -28,6 +28,9 @@
#ifdef MACOSX
#include <Cocoa/Cocoa.h>
#endif
+#ifdef LINUX
+#include <QStandardPaths>
+#endif
namespace {
TFilePath getMyDocumentsPath() {
@@ -70,6 +73,15 @@ TFilePath getDesktopPath() {
NSString *desktopDirectory = [foundref objectAtIndex:0];
return TFilePath((const char *)[desktopDirectory
cStringUsingEncoding:NSASCIIStringEncoding]);
+#elif defined LINUX
+ QString desktopPath =
+ QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
+ if (desktopPath.isEmpty()) {
+ QDir dir = QDir::home();
+ if (!dir.cd("Desktop")) return TFilePath();
+ desktopPath = dir.absolutePath();
+ }
+ return TFilePath(desktopPath.toStdString());
#else
QDir dir = QDir::home();
if (!dir.cd("Desktop")) return TFilePath();