Updated clone.go to support file not found on target
This commit is contained in:
parent
41a3e3086a
commit
e77ab09050
1
.gitignore
vendored
1
.gitignore
vendored
@ -103,3 +103,4 @@ $RECYCLE.BIN/
|
||||
.vscode/*
|
||||
|
||||
.idea
|
||||
/diskutil
|
||||
|
4
clone.go
4
clone.go
@ -25,8 +25,10 @@ func clone(cloneBs int, cloneSource string, cloneTarget string) {
|
||||
fSource, err := os.Open(cloneSource)
|
||||
defer fSource.Close()
|
||||
errorHandler(err)
|
||||
//todo add file not found handling
|
||||
fTarget, err := os.OpenFile(cloneTarget, os.O_WRONLY, 0644)
|
||||
if os.IsNotExist(err) {
|
||||
fTarget, err = os.Create(cloneTarget)
|
||||
}
|
||||
defer fTarget.Close()
|
||||
errorHandler(err)
|
||||
//todo progress indicator
|
||||
|
Loading…
Reference in New Issue
Block a user