| 43 | } |
| 44 | |
| 45 | QString CraftRuntime::findCraftRoot(Path startingPoint) |
| 46 | { |
| 47 | // CraftRuntime doesn't handle remote directories, because it needs |
| 48 | // to check file existence in the findCraftRoot() function |
| 49 | if (startingPoint.isRemote()) |
| 50 | return QString(); |
| 51 | |
| 52 | QString craftRoot; |
| 53 | while (true) { |
| 54 | bool craftSettingsIniExists = QFileInfo::exists(startingPoint.path() + QLatin1String("/etc/CraftSettings.ini")); |
| 55 | bool craftSetupHelperExists = QFileInfo::exists(startingPoint.path() + craftSetupHelperRelativePath()); |
| 56 | if (craftSettingsIniExists && craftSetupHelperExists) { |
| 57 | craftRoot = startingPoint.path(); |
| 58 | break; |
| 59 | } |
| 60 | |
| 61 | if (!startingPoint.hasParent()) |
| 62 | break; |
| 63 | startingPoint = startingPoint.parent(); |
| 64 | } |
| 65 | |
| 66 | return QFileInfo(craftRoot).canonicalFilePath(); |
| 67 | } |
| 68 | |
| 69 | QString CraftRuntime::findPython() |
| 70 | { |