Skip to content

Commit

Permalink
Fix an issue with duplicate files being restored
Browse files Browse the repository at this point in the history
  • Loading branch information
minuscorp committed Aug 2, 2020
1 parent a81edae commit 4456a3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/tunisia/Classes/Tunisia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import TunisiaKit
struct Tunisia: ParsableCommand {
static let name = String(describing: Self.self)

static let version = "0.0.3"
static let version = "0.0.5"

static var configuration = CommandConfiguration(
version: Tunisia.version,
Expand Down
6 changes: 5 additions & 1 deletion Sources/tunisia/Commands/Restore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ struct Restore: ParsableCommand {
if try FileUtils.directoryFileContents(at: directory.relativePath) {
let fileList = try FileManager.default.contentsOfDirectory(atPath: directory.relativePath)
for file in fileList where file != ".DS_Store" && file != "" {
try FileManager.default.copyItem(atPath: directory.appendingPathComponent(file, isDirectory: false).relativePath, toPath: destinationPath + "/" + directory.pathComponents.last! + "/" + file)
let fileDirectory = destinationPath + "/" + directory.pathComponents.last! + "/" + file
if FileManager.default.fileExists(atPath: fileDirectory) {
try FileUtils.remove(path: fileDirectory)
}
try FileManager.default.copyItem(atPath: directory.appendingPathComponent(file, isDirectory: false).relativePath, toPath: fileDirectory)
}
}
}
Expand Down

0 comments on commit 4456a3e

Please sign in to comment.