comparison common.cpp @ 84:8a4e26dc3182

* Make all of the "Open" options do something sensible
author Chris Cannam
date Mon, 22 Nov 2010 17:27:59 +0000
parents af7cf6f7282c
children 7ed57064f293
comparison
equal deleted inserted replaced
83:af7cf6f7282c 84:8a4e26dc3182
182 #endif 182 #endif
183 } 183 }
184 184
185 FolderStatus getFolderStatus(QString path) 185 FolderStatus getFolderStatus(QString path)
186 { 186 {
187 DEBUG << "getFolderStatus: " << path << endl;
187 QFileInfo fi(path); 188 QFileInfo fi(path);
188 if (fi.exists()) { 189 if (fi.exists()) {
190 DEBUG << "exists" << endl;
189 QDir dir(path); 191 QDir dir(path);
190 if (!dir.exists()) { // returns false for files 192 if (!dir.exists()) { // returns false for files
193 DEBUG << "not directory" << endl;
191 return FolderIsFile; 194 return FolderIsFile;
192 } 195 }
193 if (QDir(dir.filePath(".hg")).exists()) { 196 if (QDir(dir.filePath(".hg")).exists()) {
197 DEBUG << "has repo" << endl;
194 return FolderHasRepo; 198 return FolderHasRepo;
195 } 199 }
196 return FolderExists; 200 return FolderExists;
197 } else { 201 } else {
198 QDir parent = fi.dir(); 202 QDir parent = fi.dir();
199 if (parent.exists()) { 203 if (parent.exists()) {
204 DEBUG << "parent exists" << endl;
200 return FolderParentExists; 205 return FolderParentExists;
201 } 206 }
202 return FolderUnknown; 207 return FolderUnknown;
203 } 208 }
204 } 209 }