Skip to content

Commit dda8145

Browse files
authored
Merge pull request #9288 from nextcloud/i2h3/fix/crafter-rm
Check for existence of a directory to remove before attempting to do so
2 parents 35b0f2f + e1bbb70 commit dda8145

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

admin/osx/mac-crafter/Sources/Commands/Build.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,14 @@ struct Build: AsyncParsableCommand {
237237
stopwatch.record("Desktop Client Crafting")
238238

239239
if fullRebuild {
240-
do {
241-
try fm.removeItem(atPath: clientBuildURL.path)
242-
} catch let error {
243-
print("ERROR: Error removing build directory: \(error)")
244-
throw MacCrafterError.craftError("Failed to remove existing build directory!")
240+
if fm.fileExists(atPath: clientBuildURL.path) {
241+
print("Removing existing client build directory at: \(clientBuildURL.path)")
242+
243+
do {
244+
try fm.removeItem(atPath: clientBuildURL.path)
245+
} catch let error {
246+
throw MacCrafterError.craftError("Failed to remove existing build directory at: \(clientBuildURL.path)")
247+
}
245248
}
246249
} else {
247250
// HACK: When building the client we often run into issues with the shell integration

0 commit comments

Comments
 (0)