comparison 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
comparison
equal deleted inserted replaced
1295:11888b7e193d 1296:34b941921ac8
17 #include "data/fileio/FileSource.h" 17 #include "data/fileio/FileSource.h"
18 #include "data/fileio/AudioFileReaderFactory.h" 18 #include "data/fileio/AudioFileReaderFactory.h"
19 #include "data/fileio/DataFileReaderFactory.h" 19 #include "data/fileio/DataFileReaderFactory.h"
20 #include "rdf/RDFImporter.h" 20 #include "rdf/RDFImporter.h"
21 #include "rdf/RDFExporter.h" 21 #include "rdf/RDFExporter.h"
22 #include "system/System.h"
22 23
23 #include <QFileInfo> 24 #include <QFileInfo>
24 #include <QMessageBox> 25 #include <QMessageBox>
25 #include <QFileDialog> 26 #include <QFileDialog>
26 #include <QInputDialog> 27 #include <QInputDialog>
154 .arg(m_sessionExtension); 155 .arg(m_sessionExtension);
155 break; 156 break;
156 }; 157 };
157 158
158 if (lastPath == "") { 159 if (lastPath == "") {
159 char *home = getenv("HOME"); 160 std::string home;
160 if (home) lastPath = home; 161 if (getEnvUtf8("HOME", home)) {
161 else lastPath = "."; 162 lastPath = QString::fromStdString(home);
163 } else {
164 lastPath = ".";
165 }
162 } else if (QFileInfo(lastPath).isDir()) { 166 } else if (QFileInfo(lastPath).isDir()) {
163 lastPath = QFileInfo(lastPath).canonicalPath(); 167 lastPath = QFileInfo(lastPath).canonicalPath();
164 } else { 168 } else {
165 lastPath = QFileInfo(lastPath).absoluteDir().canonicalPath(); 169 lastPath = QFileInfo(lastPath).absoluteDir().canonicalPath();
166 } 170 }
303 cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: AnyFile cannot be used here" << endl; 307 cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: AnyFile cannot be used here" << endl;
304 abort(); 308 abort();
305 }; 309 };
306 310
307 if (lastPath == "") { 311 if (lastPath == "") {
308 char *home = getenv("HOME"); 312 std::string home;
309 if (home) lastPath = home; 313 if (getEnvUtf8("HOME", home)) {
310 else lastPath = "."; 314 lastPath = QString::fromStdString(home);
315 } else {
316 lastPath = ".";
317 }
311 } else if (QFileInfo(lastPath).isDir()) { 318 } else if (QFileInfo(lastPath).isDir()) {
312 lastPath = QFileInfo(lastPath).canonicalPath(); 319 lastPath = QFileInfo(lastPath).canonicalPath();
313 } else { 320 } else {
314 lastPath = QFileInfo(lastPath).absoluteDir().canonicalPath(); 321 lastPath = QFileInfo(lastPath).absoluteDir().canonicalPath();
315 } 322 }