From d5778bafb6f573d80b783dcf245c5c0a904d55a2 Mon Sep 17 00:00:00 2001
From: Phil Olynyk <phil@pholynyk.ca>
Date: Tue, 25 Aug 2020 21:09:53 -0400
Subject: [PATCH] Check Crostini mount points, and force name to OSCAR-test if
 not OSCAR

---
 oscar/SleepLib/common.cpp |  9 ++++++---
 oscar/mainwindow.cpp      | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp
index 9bfe936c..496259d2 100644
--- a/oscar/SleepLib/common.cpp
+++ b/oscar/SleepLib/common.cpp
@@ -227,10 +227,13 @@ QString appResourcePath()
     QStringList paths;
     // This one will be used if the Html and Translations folders 
     // are in the same folder as  the OSCAR executable
-    paths.push_back( QCoreApplication::applicationDirPath() );
+    paths.append( QCoreApplication::applicationDirPath() );
 #ifdef Q_OS_LINUX    
-    paths.push_back( QString( "/usr/share/" ) + QCoreApplication::applicationName() );
-    paths.push_back( QString( "/usr/local/share/" ) + QCoreApplication::applicationName() );
+    QString appName = QCoreApplication::applicationName();
+    if (appName != QString("OSCAR"))
+        appName = QString("OSCAR-test");
+    paths.append( QString( "/usr/share/" ) + appName );
+    paths.append( QString( "/usr/local/share/" ) + appName );
 #endif    
     for (auto p = begin(paths); p != end(paths); ++p ) {
         QString fname = *p+QString("/Translations/oscar_qt_fr.qm");
diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp
index 6a9fbe15..196e1ba7 100644
--- a/oscar/mainwindow.cpp
+++ b/oscar/mainwindow.cpp
@@ -832,11 +832,23 @@ QStringList getDriveList()
 #endif            
             if (storage.fileSystemType() == VFAT) {
                 qDebug() << "Adding" << storage.name() << "on" << storage.rootPath() << "to drivelist";
-                drivelist.push_back(storage.rootPath());
+                drivelist.append(storage.rootPath());
             }
         }
     }
 #endif
+#if defined(Q_OS_LINUX)
+    QString mntName("/mnt/chromeos/removeable");
+    QDir mnt(mntName);
+    if ( mnt.exists() ) {
+        qDebug() << "Checking Crostini removable folders";
+        QFileInfoList mntPts = mnt.entryInfoList();
+        foreach ( const auto dir, mntPts ) {
+            qDebug() << "Adding" << dir.filePath() << "to drivelist";
+            drivelist.append(dir.filePath() );
+        }
+    }
+#endif    
     return drivelist;
 }