refactor: get current dir

This commit is contained in:
debugtalk
2022-12-15 23:20:49 +08:00
parent 358b7dd685
commit ee68b954fb
14 changed files with 64 additions and 39 deletions

View File

@@ -1,6 +1,9 @@
package env
import "os"
import (
"os"
"path/filepath"
)
var (
WDA_USB_DRIVER = os.Getenv("WDA_USB_DRIVER")
@@ -14,3 +17,24 @@ var (
PYPI_INDEX_URL = os.Getenv("PYPI_INDEX_URL")
PATH = os.Getenv("PATH")
)
const (
ResultsDir = "results"
)
var (
RootDir string
ResultsPath string
ScreenShotsPath string
)
func init() {
var err error
RootDir, err = os.Getwd()
if err != nil {
panic(err)
}
ResultsPath = filepath.Join(RootDir, ResultsDir)
ScreenShotsPath = filepath.Join(ResultsPath, "screenshots")
}