mirror of
https://github.com/gogs/gogs.git
synced 2025-12-22 00:00:07 +01:00
19 lines
383 B
Go
19 lines
383 B
Go
|
|
// Copyright 2020 The Gogs Authors. All rights reserved.
|
||
|
|
// Use of this source code is governed by a MIT-style
|
||
|
|
// license that can be found in the LICENSE file.
|
||
|
|
|
||
|
|
package osutil
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
)
|
||
|
|
|
||
|
|
// IsFile returns true if given path exists as a file (i.e. not a directory).
|
||
|
|
func IsFile(path string) bool {
|
||
|
|
f, e := os.Stat(path)
|
||
|
|
if e != nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
return !f.IsDir()
|
||
|
|
}
|