-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use XDG_CONFIG_HOME for config and theme (#34)
* default config and theme to XDG_CONFIG_HOME * copy default theme and config to XDG_CONFIG_HOME if they do not exist
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package internal | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
) | ||
|
||
// copy file from src to dst | ||
func CopyFile(src, dst string) (int64, error) { | ||
sourceFileStat, err := os.Stat(src) | ||
if err != nil { | ||
return 0, err | ||
} | ||
|
||
if !sourceFileStat.Mode().IsRegular() { | ||
return 0, fmt.Errorf("%s is not a regular file", src) | ||
} | ||
|
||
source, err := os.Open(src) | ||
if err != nil { | ||
return 0, err | ||
} | ||
defer source.Close() | ||
|
||
destination, err := os.Create(dst) | ||
if err != nil { | ||
return 0, err | ||
} | ||
defer destination.Close() | ||
nBytes, err := io.Copy(destination, source) | ||
return nBytes, err | ||
} |