1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 23:01:28 +00:00

Merge pull request #353 from shxsun/master

initial utils dir
This commit is contained in:
astaxie 2013-12-08 21:45:11 -08:00
commit 690ecb8168
2 changed files with 24 additions and 0 deletions

11
utils/file.go Normal file
View 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
View 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)
}