Skip to content

Commit 9f14df9

Browse files
feat(move-group): backup merge conflict
1 parent daf7754 commit 9f14df9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Sources/XcodeProjectCLI/Subcommands/Groups/MoveGroupCommand.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ struct MoveGroupCommand: ParsableCommand {
8383
}
8484
} else {
8585
if fileManager.fileExists(atPath: destPath) {
86-
try fileManager.removeItem(atPath: sourcePath)
87-
print("Warning: File \(item) already exists at destination. Source file has been removed.")
86+
let bakPath = destPath.asInputPath.changeLastComponent(
87+
to: "\(destPath.asInputPath.lastComponent).bak"
88+
).absolutePath
89+
try fileManager.moveItem(atPath: sourcePath, toPath: bakPath)
90+
print("Warning: File \(item) already exists at destination. Backup created at \(bakPath).")
8891
} else {
8992
try fileManager.moveItem(atPath: sourcePath, toPath: destPath)
9093
}

0 commit comments

Comments
 (0)