diff --git a/.gitignore b/.gitignore index 085f9fd..fea1400 100644 --- a/.gitignore +++ b/.gitignore @@ -102,4 +102,5 @@ $RECYCLE.BIN/ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) .vscode/* -.idea \ No newline at end of file +.idea +/diskutil diff --git a/clone.go b/clone.go index d729b20..7e962b2 100644 --- a/clone.go +++ b/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