changeset 349:b422d1bcfb3c

Merge from branch "bug_92"
author Chris Cannam
date Wed, 16 Mar 2011 12:18:50 +0000
parents 987a094047c9 (current diff) 076c2b3de51b (diff)
children 293d91cf44de 39a616befdbd
files
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mainwindow.cpp	Wed Mar 16 10:46:10 2011 +0000
+++ b/mainwindow.cpp	Wed Mar 16 12:18:50 2011 +0000
@@ -1243,14 +1243,25 @@
 
 QString MainWindow::complainAboutCloneToExistingFolder(QString arg, QString remote)
 {
-    // If the directory "arg" exists but "arg" plus the last path
-    // component of "remote" does not, then offer the latter as an
-    // alternative path
+    // If the directory "arg" exists but is empty, then we accept it.
+
+    // If the directory "arg" exists and is non-empty, but "arg" plus
+    // the last path component of "remote" does not exist, then offer
+    // the latter as an alternative path.
 
     QString offer;
 
     QDir d(arg);
+
     if (d.exists()) {
+
+        if (d.entryList(QDir::Dirs | QDir::Files |
+                        QDir::NoDotAndDotDot |
+                        QDir::Hidden | QDir::System).empty()) {
+            // directory is empty; accept it
+            return arg;
+        }
+
         if (QRegExp("^\\w+://").indexIn(remote) >= 0) {
             QString rpath = QUrl(remote).path();
             if (rpath != "") {