aboutsummaryrefslogtreecommitdiffsponsor
path: root/filesystem.go
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2022-05-05 08:14:42 -0500
committerSlack Coder <slackcoder@server.ky>2022-05-05 08:23:00 -0500
commit54b4b1d11ac5e893715d2ed509ee251dfc46a598 (patch)
tree29bc57494892e4ab9c15deb587d740f3ace26b21 /filesystem.go
parentc74d8aa270583ab2d2a38d41439312af3ea0d810 (diff)
downloadpkgtools-go-54b4b1d11ac5e893715d2ed509ee251dfc46a598.tar.xz
installpkg: support no-overwrite option
Diffstat (limited to 'filesystem.go')
-rw-r--r--filesystem.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/filesystem.go b/filesystem.go
index dec07f3..f744714 100644
--- a/filesystem.go
+++ b/filesystem.go
@@ -32,6 +32,17 @@ func HumanReadableSize(size int64) string {
return ret
}
+func IsExist(path string) (bool, error) {
+ _, err := os.Stat(path)
+ if os.IsNotExist(err) {
+ return false, nil
+ }
+ if err != nil {
+ return false, err
+ }
+ return true, nil
+}
+
func IsFile(path string) (bool, error) {
info, err := os.Stat(path)
if err != nil {