QFileInfo selFile(path);
if (!selFile.exists()) {
- return checkPathValidityRecursive(selFile.dir().path());
+ QString parentPath = selFile.dir().path();
+ if (parentPath != path)
+ return checkPathValidityRecursive(parentPath);
+ return FolderMan::tr("The selected path does not exist!");
}
if (!selFile.isDir()) {
QVERIFY(!folderman->checkPathValidityForNewFolder("/usr/bin/somefolder").isNull());
#endif
+#ifdef Q_OS_WIN // drive-letter tests
+ if (!QFileInfo("v:/").exists()) {
+ QVERIFY(!folderman->checkPathValidityForNewFolder("v:").isNull());
+ QVERIFY(!folderman->checkPathValidityForNewFolder("v:/").isNull());
+ QVERIFY(!folderman->checkPathValidityForNewFolder("v:/foo").isNull());
+ }
+ if (QFileInfo("c:/").isWritable()) {
+ QVERIFY(folderman->checkPathValidityForNewFolder("c:").isNull());
+ QVERIFY(folderman->checkPathValidityForNewFolder("c:/").isNull());
+ QVERIFY(folderman->checkPathValidityForNewFolder("c:/foo").isNull());
+ }
+#endif
+
// Invalid paths
QVERIFY(!folderman->checkPathValidityForNewFolder("").isNull());