From 940d0f1906defb19c0b65aa32c382d78cd15e5a0 Mon Sep 17 00:00:00 2001 From: Atterpac <89053530+atterpac@users.noreply.github.com> Date: Sat, 25 May 2024 00:20:42 -0600 Subject: [PATCH] fix windows cross volume init (#3512) changelog --- mkdocs-website/docs/en/changelog.md | 1 + v3/internal/templates/templates.go | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mkdocs-website/docs/en/changelog.md b/mkdocs-website/docs/en/changelog.md index 73fa0bfbf..44ad3cf6c 100644 --- a/mkdocs-website/docs/en/changelog.md +++ b/mkdocs-website/docs/en/changelog.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed cross volume project install for windows by [atterpac](https://github.com/atterac) in [#3512](https://github.com/wailsapp/wails/pull/3512) - Fixed react template css to show footer by [atterpac](https://github.com/atterpac) in [#3477](https://github.com/wailsapp/wails/pull/3477) - Fixed zombie processes when working in devmode by updating to latest refresh by [Atterpac](https://github.com/atterpac) in [#3320](https://github.com/wailsapp/wails/pull/3320). - Fixed appimage webkit file sourcing by [Atterpac](https://github.com/atterpac) in [#3306](https://github.com/wailsapp/wails/pull/3306). diff --git a/v3/internal/templates/templates.go b/v3/internal/templates/templates.go index 84cba9e8c..70b46ca52 100644 --- a/v3/internal/templates/templates.go +++ b/v3/internal/templates/templates.go @@ -201,20 +201,27 @@ func getRemoteTemplate(uri string) (template *Template, err error) { } func Install(options *flags.Init) error { - + var wd string = lo.Must(os.Getwd()) var projectDir string if options.ProjectDir == "." || options.ProjectDir == "" { - projectDir = lo.Must(os.Getwd()) + projectDir = wd + } else { + projectDir = options.ProjectDir } var err error - projectDir, err = filepath.Abs(filepath.Join(options.ProjectDir, options.ProjectName)) + projectDir, err = filepath.Abs(filepath.Join(projectDir, options.ProjectName)) if err != nil { return err } // Calculate relative path from project directory to LocalModulePath var relativePath string - relativePath, err = filepath.Rel(projectDir, debug.LocalModulePath) + // Check if the project directory and LocalModulePath are in the same drive + if filepath.VolumeName(wd) != filepath.VolumeName(debug.LocalModulePath) { + relativePath = debug.LocalModulePath + } else { + relativePath, err = filepath.Rel(projectDir, debug.LocalModulePath) + } if err != nil { return err }