diff options
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r-- | modules/setting/setting.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index f826a3a4..c39fab43 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -168,7 +168,18 @@ func ExecPath() (string, error) { // WorkDir returns absolute path of work directory. func WorkDir() (string, error) { execPath, err := ExecPath() - return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err + if err != nil { + return execPath, err + } + + // Note: we don't use path.Dir here because it does not handle case + // which path starts with two "/" in Windows: "//psf/Home/..." + execPath = strings.Replace(execPath, "\\", "/", -1) + i := strings.LastIndex(execPath, "/") + if i == -1 { + return execPath, nil + } + return execPath[:i], nil } func forcePathSeparator(path string) { @@ -192,11 +203,11 @@ func NewConfigContext() { CustomPath = os.Getenv("GOGS_CUSTOM") if len(CustomPath) == 0 { - CustomPath = path.Join(workDir, "custom") + CustomPath = workDir + "/custom" } if len(CustomConf) == 0 { - CustomConf = path.Join(CustomPath, "conf/app.ini") + CustomConf = CustomPath + "/conf/app.ini" } if com.IsFile(CustomConf) { @@ -449,10 +460,10 @@ func newLogService() { func newCacheService() { CacheAdapter = Cfg.Section("cache").Key("ADAPTER").In("memory", []string{"memory", "redis", "memcache"}) if EnableRedis { - log.Info("Redis Enabled") + log.Info("Redis Supported") } if EnableMemcache { - log.Info("Memcache Enabled") + log.Info("Memcache Supported") } switch CacheAdapter { |