Win: Fix filesystem detection for exFAT workaround #2701
authorChristian Kamm <mail@ckamm.de>
Tue, 19 Jan 2016 08:58:00 +0000 (09:58 +0100)
committerChristian Kamm <mail@ckamm.de>
Tue, 19 Jan 2016 09:00:12 +0000 (10:00 +0100)
src/libsync/filesystem.cpp
src/libsync/syncjournaldb.cpp

index 3cd2781cf7ff2769561c3adf7abf4932520158f2..09fd1682680be23f9fb7b00eea3678ddd19d45ae 100644 (file)
@@ -476,9 +476,10 @@ bool FileSystem::fileExists(const QString& filename, const QFileInfo& fileInfo)
 QString FileSystem::fileSystemForPath(const QString & path)
 {
     // See also QStorageInfo (Qt >=5.4) and GetVolumeInformationByHandleW (>= Vista)
-    QString drive = path.left(3);
-    if (! drive.endsWith(":\\"))
+    QString drive = path.left(2);
+    if (! drive.endsWith(":"))
         return QString();
+    drive.append('\\');
 
     const size_t fileSystemBufferSize = 4096;
     TCHAR fileSystemBuffer[fileSystemBufferSize];
index 1fa8c54c99c0f56d051dabf3ac392c3bb69ad3e0..d492efa07c61eb7b10ff0b569d5a02d531e37037 100644 (file)
@@ -112,8 +112,9 @@ static QString defaultJournalMode(const QString & dbPath)
     // See #2693: Some exFAT file systems seem unable to cope with the
     // WAL journaling mode. They work fine with DELETE.
     QString fileSystem = FileSystem::fileSystemForPath(dbPath);
+    qDebug() << "Detected filesystem" << fileSystem << "for" << dbPath;
     if (fileSystem.contains("FAT")) {
-        qDebug() << "Detected filesystem" << fileSystem << "- using DELETE journal mode";
+        qDebug() << "Filesystem contains FAT - using DELETE journal mode";
         return "DELETE";
     }
 #else