From 981ce4f8ad438e6a753f22b75646b877fb462aee Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 21 Sep 2021 20:11:25 +1000 Subject: [PATCH] [v2] Always generate into subdir --- .../initialise/templates/templates.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates.go b/v2/cmd/wails/internal/commands/initialise/templates/templates.go index 59174268..ea69a8ce 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates.go @@ -169,23 +169,10 @@ func Install(options *Options) (bool, *Template, error) { // Did the user want to install in current directory? if options.TargetDir == "" { - - // If the current directory is empty, use it - isEmpty, err := fs.DirIsEmpty(cwd) - if err != nil { - return false, nil, err + options.TargetDir = filepath.Join(cwd, options.ProjectName) + if fs.DirExists(options.TargetDir) { + return false, nil, fmt.Errorf("cannot create project directory. Dir exists: %s", options.TargetDir) } - - if isEmpty { - // Yes - use cwd - options.TargetDir = cwd - } else { - options.TargetDir = filepath.Join(cwd, options.ProjectName) - if fs.DirExists(options.TargetDir) { - return false, nil, fmt.Errorf("cannot create project directory. Dir exists: %s", options.TargetDir) - } - } - } else { // Get the absolute path of the given directory targetDir, err := filepath.Abs(filepath.Join(cwd, options.TargetDir))