]> gitweb.hamatoma.de Git - reqt/commitdiff
ReFind: native path
authorHamatoma <git.tortouse@hm.f-r-e-i.de>
Sun, 20 Dec 2015 07:50:33 +0000 (08:50 +0100)
committerHamatoma <git.tortouse@hm.f-r-e-i.de>
Sun, 20 Dec 2015 07:50:33 +0000 (08:50 +0100)
appl/refind/filefinder.cpp
appl/refind/mainwindow.cpp
base/ReFileUtils.hpp

index 330d0eca33b3e546426bec7277ba5d6c2eca69c4..2869c343fe0809a536ca2955005f0da8f0da7f38 100644 (file)
@@ -193,7 +193,9 @@ void FileFinder::search(){
        }
        clock_t start = clock();
        m_table->setSortingEnabled(false);
-       fillTable(ReQStringUtils::chomp(m_baseDir, OS_SEPARATOR), 0);
+    QString path = ReFileUtils::nativePath(m_baseDir);
+    path = ReQStringUtils::chomp(path, OS_SEPARATOR);
+    fillTable(path, 0);
        m_statistics.m_runtimeSeconds = (double) (clock() - start)
           / CLOCKS_PER_SEC;
        if (m_announcer != NULL){
index 1785a97cc6b7f00ca5ec588d6c0f26d45245cc5c..b911aa541c1a3edb128ef0c32cff6049e58587eb 100644 (file)
@@ -864,7 +864,7 @@ void MainWindow::selectDirectory(){
 QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"),
    ui->comboBoxDirectory->currentText(), QFileDialog::ShowDirsOnly);
 if (!dir.isEmpty())
-   ui->comboBoxDirectory->setCurrentText(dir);
+   ui->comboBoxDirectory->setCurrentText(ReFileUtils::nativePath(dir));
 }
 
 /**
@@ -907,7 +907,7 @@ QDir dir(path);
 if (dir.exists()){
    dir.cdUp();
    if (dir.exists()){
-         path = dir.absolutePath();
+      path = ReFileUtils::nativePath(dir.absolutePath());
          ui->comboBoxDirectory->setEditText(path);
          setInHistory(ui->comboBoxDirectory, path);
    }
index dec87d80439dd279f3e55dd0711f50d11db5c5f8..44251da11ba6e927d0a19f39941563d45e44deac 100644 (file)
@@ -36,6 +36,32 @@ public:
        static QByteArray extensionOf(const char* filename);
        static bool isAbsolutPath(const QString& path);
        static bool isAbsolutPath(const char* path);
+       /** Returns a path with native separators.
+        * QT under windows can operator with 2 separators: '\\' and '/'.
+        * '\\' is the native separator.
+        * @param path  the path to inspect
+        * @return the path with native separators.
+        */
+       inline static QString nativePath(QString path){
+#if defined __linux__
+               return path;
+#elif defined WIN32
+               return path.replace(OS_2nd_SEPARATOR, OS_SEPARATOR);
+#endif
+       }
+       /** Returns a path with native separators.
+        * QT under windows can operator with 2 separators: '\\' and '/'.
+        * '\\' is the native separator.
+        * @param path  the path to inspect
+        * @return the path with native separators.
+        */
+       inline static QByteArray nativePath(QByteArray path){
+#if defined __linux__
+               return path;
+#elif defined WIN32
+               return path.replace(OS_2nd_SEPARATOR, OS_SEPARATOR);
+#endif
+       }
        static QString nodeOf(const QString& filename);
        static QByteArray nodeOf(const char* filename);
        static QString parentOf(const QString& filename);