File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
AtCoderLibrary/Command/New/Generator Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import SwiftShell
55struct Command : ParsableCommand {
66 static var configuration = CommandConfiguration (
77 abstract: " AtCoder CLI for Swift. " ,
8- version: " 1.0.8 " ,
8+ version: " 1.0.9 " ,
99 subcommands: [
1010 New . self,
1111 Submit . self,
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ extension Generator {
1111 if let directory = directory {
1212 try FileManager . default. createDirectory ( atPath: directory, withIntermediateDirectories: true )
1313 }
14- try source. write ( toFile: " \( directory ?? " . " ) / \( fileName) " , atomically: true , encoding: . utf8)
14+ let filePath = " \( directory ?? " . " ) / \( fileName) "
15+ guard !FileManager. default. fileExists ( atPath: filePath) else {
16+ print ( " Skip file creation because the file exists. " , " path: " , filePath)
17+ return
18+ }
19+ try source. write ( toFile: filePath, atomically: true , encoding: . utf8)
1520 }
1621}
You can’t perform that action at this time.
0 commit comments