Browse Source

allow to specify WorkDir via env var

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
pull/1284/head
Vasiliy Tolstov 10 years ago
parent
commit
aa5f077f78
  1. 4
      modules/setting/setting.go

4
modules/setting/setting.go

@ -162,9 +162,13 @@ func ExecPath() (string, error) {
// WorkDir returns absolute path of work directory. // WorkDir returns absolute path of work directory.
func WorkDir() (string, error) { func WorkDir() (string, error) {
work := os.Getenv("WORK_DIR")
if len(work) == 0 {
execPath, err := ExecPath() execPath, err := ExecPath()
return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err
} }
return work, nil
}
func forcePathSeparator(path string) { func forcePathSeparator(path string) {
if strings.Contains(path, "\\") { if strings.Contains(path, "\\") {

Loading…
Cancel
Save