Fixed slash/backslash issue, in the Alpine tab, to follow platform requirement
authorJean-Paul Mari <djipi.mari@gmail.com>
Wed, 5 Sep 2018 17:56:03 +0000 (13:56 -0400)
committerJean-Paul Mari <djipi.mari@gmail.com>
Wed, 5 Sep 2018 17:56:03 +0000 (13:56 -0400)
src/gui/alpinetab.cpp
src/gui/alpinetab.h

index a1fcf42..23f8b24 100644 (file)
@@ -6,10 +6,13 @@
 // See the README and GPLv3 files for licensing and warranty information
 //
 // JLH = James Hammons <jlhamm@acm.org>
 // See the README and GPLv3 files for licensing and warranty information
 //
 // JLH = James Hammons <jlhamm@acm.org>
+// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
 // JLH  07/15/2011  Created this file
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
 // JLH  07/15/2011  Created this file
+// JPM  09/03/2018  Depend the platform transform slashes or backslashes
+//
 
 #include "alpinetab.h"
 #include "settings.h"
 
 #include "alpinetab.h"
 #include "settings.h"
@@ -94,9 +97,20 @@ void AlpineTab::SetSettings(void)
 {
        bool ok;
 
 {
        bool ok;
 
-       strcpy(vjs.alpineROMPath, edit1->text().toUtf8().data());
-       strcpy(vjs.absROMPath, edit2->text().toUtf8().data());
+       strcpy(vjs.alpineROMPath, CheckForSlashes(edit1->text()).toUtf8().data());
+       strcpy(vjs.absROMPath, CheckForSlashes(edit2->text()).toUtf8().data());
        vjs.refresh = edit3->text().toUInt(&ok, 10);
        vjs.allowWritesToROM = writeROM->isChecked();
 }
 
        vjs.refresh = edit3->text().toUInt(&ok, 10);
        vjs.allowWritesToROM = writeROM->isChecked();
 }
 
+
+// Depend the platform transform slashes or backslashes
+QString AlpineTab::CheckForSlashes(QString s)
+{
+#ifdef _WIN32
+       s.replace(QString("/"), QString("\\"));
+#else
+       s.replace(QString("\\"), QString("/"));
+#endif
+       return s;
+}
index 877a7e4..81adae8 100644 (file)
@@ -13,13 +13,15 @@ class AlpineTab: public QWidget
                void SetSettings(void);\r
                void GetSettings(void);\r
 \r
                void SetSettings(void);\r
                void GetSettings(void);\r
 \r
+       private:\r
+               QString CheckForSlashes(QString);\r
+\r
        public:\r
                QLineEdit * edit1;\r
                QLineEdit * edit2;\r
                QLineEdit * edit3;\r
 //             QLineEdit * edit3;\r
 //             QLineEdit * edit4;\r
        public:\r
                QLineEdit * edit1;\r
                QLineEdit * edit2;\r
                QLineEdit * edit3;\r
 //             QLineEdit * edit3;\r
 //             QLineEdit * edit4;\r
-\r
                QCheckBox * writeROM;\r
 //             QCheckBox * useDSP;\r
 //             QCheckBox * useHostAudio;\r
                QCheckBox * writeROM;\r
 //             QCheckBox * useDSP;\r
 //             QCheckBox * useHostAudio;\r