mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 20:40:50 +00:00
initial utils dir
This commit is contained in:
parent
4fa625dea6
commit
830ccb6660
11
utils/file.go
Normal file
11
utils/file.go
Normal file
@ -0,0 +1,11 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func SelfPath() string {
|
||||
path, _ := filepath.Abs(os.Args[0])
|
||||
return path
|
||||
}
|
13
utils/file_test.go
Normal file
13
utils/file_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSelfPath(t *testing.T) {
|
||||
path := SelfPath()
|
||||
if path == "" {
|
||||
t.Error("path cannot be empty")
|
||||
}
|
||||
t.Logf("SelfPath: %s", path)
|
||||
}
|
Loading…
Reference in New Issue
Block a user