diff widgets/InteractiveFileFinder.cpp @ 1296:34b941921ac8 plugin-path-config

Use type keys as indices rather than labels
author Chris Cannam
date Fri, 08 Jun 2018 14:31:47 +0100
parents 6828735468c9
children c8a6fd3f9dff
line wrap: on
line diff
--- a/widgets/InteractiveFileFinder.cpp	Wed Jun 06 15:55:49 2018 +0100
+++ b/widgets/InteractiveFileFinder.cpp	Fri Jun 08 14:31:47 2018 +0100
@@ -19,6 +19,7 @@
 #include "data/fileio/DataFileReaderFactory.h"
 #include "rdf/RDFImporter.h"
 #include "rdf/RDFExporter.h"
+#include "system/System.h"
 
 #include <QFileInfo>
 #include <QMessageBox>
@@ -156,9 +157,12 @@
     };
 
     if (lastPath == "") {
-        char *home = getenv("HOME");
-        if (home) lastPath = home;
-        else lastPath = ".";
+        std::string home;
+        if (getEnvUtf8("HOME", home)) {
+            lastPath = QString::fromStdString(home);
+        } else {
+            lastPath = ".";
+        }
     } else if (QFileInfo(lastPath).isDir()) {
         lastPath = QFileInfo(lastPath).canonicalPath();
     } else {
@@ -305,9 +309,12 @@
     };
 
     if (lastPath == "") {
-        char *home = getenv("HOME");
-        if (home) lastPath = home;
-        else lastPath = ".";
+        std::string home;
+        if (getEnvUtf8("HOME", home)) {
+            lastPath = QString::fromStdString(home);
+        } else {
+            lastPath = ".";
+        }
     } else if (QFileInfo(lastPath).isDir()) {
         lastPath = QFileInfo(lastPath).canonicalPath();
     } else {