Convert root path to absolute path on create command

Signed-off-by: Amim Knabben <amim.knabben@gmail.com>
This commit is contained in:
root
2020-10-03 01:59:33 +00:00
committed by Amim Knabben
parent 09ddc63afd
commit ede8a86ec1
2 changed files with 18 additions and 0 deletions

View File

@@ -92,6 +92,21 @@ func revisePidFile(context *cli.Context) error {
return context.Set("pid-file", pidFile)
}
// reviseRootDir convert the root to absolute path
func reviseRootDir(context *cli.Context) error {
root := context.GlobalString("root")
if root == "" {
return nil
}
root, err := filepath.Abs(root)
if err != nil {
return err
}
return context.GlobalSet("root", root)
}
// parseBoolOrAuto returns (nil, nil) if s is empty or "auto"
func parseBoolOrAuto(s string) (*bool, error) {
if s == "" || strings.ToLower(s) == "auto" {