diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-24 21:13:56 +0800 |
---|---|---|
committer | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-24 21:13:56 +0800 |
commit | 0c064b1b79bc5fe0558fb5ba1a185cfc27a77f75 (patch) | |
tree | a8d28225a2a36ee2e92a83cf64016466d9eb39f4 /internal/osutil/osutil.go | |
parent | 63e56facbf96204e32c5407b3d5ff8d3d3612bac (diff) |
cmd/web: fix error when Unix socket not exists
Diffstat (limited to 'internal/osutil/osutil.go')
-rw-r--r-- | internal/osutil/osutil.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/osutil/osutil.go b/internal/osutil/osutil.go index 656f2e2a..827988a0 100644 --- a/internal/osutil/osutil.go +++ b/internal/osutil/osutil.go @@ -17,6 +17,12 @@ func IsFile(path string) bool { return !f.IsDir() } +// IsExist returns true if a file or directory exists. +func IsExist(path string) bool { + _, err := os.Stat(path) + return err == nil || os.IsExist(err) +} + // CurrentUsername returns the current system user via environment variables. func CurrentUsername() string { curUserName := os.Getenv("USER") |