diff options
author | Unknown <joe2010xtmf@163.com> | 2014-07-12 00:55:19 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-07-12 00:55:19 -0400 |
commit | 0f907301b7fbd05faf07bc22b3316ae1093c6724 (patch) | |
tree | 806e40ea6ef651e28563d09526377ed736528c10 /cmd/fix.go | |
parent | 63cc14062a891a99a429f2eef0ee90a3f5795f47 (diff) | |
download | gitea-0f907301b7fbd05faf07bc22b3316ae1093c6724.tar.gz gitea-0f907301b7fbd05faf07bc22b3316ae1093c6724.zip |
Fix #285
Diffstat (limited to 'cmd/fix.go')
-rw-r--r-- | cmd/fix.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/fix.go b/cmd/fix.go index 95ab3ae66f..dfcd04aa89 100644 --- a/cmd/fix.go +++ b/cmd/fix.go @@ -11,6 +11,7 @@ import ( "io/ioutil" "os" "path" + "runtime" "strings" "github.com/codegangsta/cli" @@ -93,9 +94,16 @@ func rewriteAuthorizedKeys(sshPath, oldPath, newPath string) error { } func rewriteUpdateHook(path, appPath string) error { - rp := strings.NewReplacer("\\", "/", " ", "\\ ") + if runtime.GOOS == "windows" { + rp := strings.NewReplacer("\\", "/") + appPath = "\"" + rp.Replace(appPath) + "\"" + } else { + rp := strings.NewReplacer("\\", "/", " ", "\\ ") + appPath = rp.Replace(appPath) + } + if err := ioutil.WriteFile(path, []byte(fmt.Sprintf(models.TPL_UPDATE_HOOK, - setting.ScriptType, rp.Replace(appPath))), os.ModePerm); err != nil { + setting.ScriptType, appPath)), os.ModePerm); err != nil { return err } return nil |