diff options
author | Alex Myasoedov <msoedov@gmail.com> | 2016-05-24 03:10:05 +0300 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-05-23 17:10:05 -0700 |
commit | 84d9aff8a236c02e30ee1607bd1f052d8c3cbb99 (patch) | |
tree | 453c6c0300594a757d429e03d12a3ea71521eed4 /cmd/dump.go | |
parent | 12d30255a789df43672617c549bd3db2d6a4b4f6 (diff) | |
download | gitea-84d9aff8a236c02e30ee1607bd1f052d8c3cbb99.tar.gz gitea-84d9aff8a236c02e30ee1607bd1f052d8c3cbb99.zip |
gogs dump tempdir flag (#3086)
Diffstat (limited to 'cmd/dump.go')
-rw-r--r-- | cmd/dump.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/dump.go b/cmd/dump.go index 0a2f4e9cba..62f45ed785 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -28,7 +28,8 @@ It can be used for backup and capture Gogs server image to send to maintainer`, Action: runDump, Flags: []cli.Flag{ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"), - boolFlag("verbose, v", "show process details"), + boolFlag("verbose, v", "Show process details"), + stringFlag("tempdir, t", os.TempDir(), "Temporary dir path"), }, } @@ -40,7 +41,11 @@ func runDump(ctx *cli.Context) error { models.LoadConfigs() models.SetEngine() - TmpWorkDir, err := ioutil.TempDir(os.TempDir(), "gogs-dump-") + tmpDir := ctx.String("tempdir") + if _, err := os.Stat(tmpDir); os.IsNotExist(err) { + log.Fatalf("Path does not exist: %s", tmpDir) + } + TmpWorkDir, err := ioutil.TempDir(tmpDir, "gogs-dump-") if err != nil { log.Fatalf("Fail to create tmp work directory: %v", err) } |