diff --git a/commands/hugo.go b/commands/hugo.go index ef3df9d71..89e1094c3 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -329,7 +329,8 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error { } if Source != "" { - viper.Set("WorkingDir", Source) + dir, _ := filepath.Abs(Source) + viper.Set("WorkingDir", dir) } else { dir, _ := os.Getwd() viper.Set("WorkingDir", dir) diff --git a/commands/server.go b/commands/server.go index 3e41a14b4..ee4d38a18 100644 --- a/commands/server.go +++ b/commands/server.go @@ -159,7 +159,7 @@ func server(cmd *cobra.Command, args []string) error { // Watch runs its own server as part of the routine if serverWatch { watchDirs := getDirList() - baseWatchDir := helpers.AbsPathify(viper.GetString("WorkingDir")) + baseWatchDir := viper.GetString("WorkingDir") for i, dir := range watchDirs { watchDirs[i], _ = helpers.GetRelativePath(dir, baseWatchDir) } diff --git a/helpers/path.go b/helpers/path.go index ae33d2900..757cedefb 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -130,7 +130,7 @@ func AbsPathify(inPath string) string { return filepath.Clean(inPath) } - // todo consider move workingDir to argument list + // TODO(bep): Consider moving workingDir to argument list return filepath.Clean(filepath.Join(viper.GetString("WorkingDir"), inPath)) }