mirror of
https://github.com/gogs/gogs.git
synced 2026-11-29 21:14:36 +01:00
26 lines
471 B
Go
26 lines
471 B
Go
package git
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
// isDir returns true if given path is a directory, or returns false when it's a
|
|
// file or does not exist.
|
|
func isDir(dir string) bool {
|
|
f, e := os.Stat(dir)
|
|
if e != nil {
|
|
return false
|
|
}
|
|
return f.IsDir()
|
|
}
|
|
|
|
// isFile returns true if given path is a file, or returns false when it's a
|
|
// directory or does not exist.
|
|
func isFile(filePath string) bool {
|
|
f, e := os.Stat(filePath)
|
|
if e != nil {
|
|
return false
|
|
}
|
|
return !f.IsDir()
|
|
}
|