Version online
This commit is contained in:
@@ -32,4 +32,22 @@ func CopyFile(src string, dst string) (error) {
|
||||
return errCopy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CopyContentFile(content string, dst string) (error) {
|
||||
|
||||
folderPath := filepath.Dir(dst)
|
||||
os.MkdirAll(folderPath, os.ModePerm)
|
||||
|
||||
fout, errCreate := os.Create(dst)
|
||||
if errCreate != nil {
|
||||
return errCreate
|
||||
}
|
||||
defer fout.Close()
|
||||
|
||||
_, errCopy := fout.WriteString(content)
|
||||
if errCopy != nil {
|
||||
return errCopy
|
||||
}
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user