diff --git a/pkg/build/buildcmd/cmd_project.go b/pkg/build/buildcmd/cmd_project.go index c51adbf9..f25249fd 100644 --- a/pkg/build/buildcmd/cmd_project.go +++ b/pkg/build/buildcmd/cmd_project.go @@ -77,6 +77,8 @@ func runProjectBuild(ctx context.Context, buildType string, ciMode bool, targets if !filepath.IsAbs(outputDir) { outputDir = filepath.Join(projectDir, outputDir) } + outputDir = filepath.Clean(outputDir) + // Ensure config path is absolute if provided if configPath != "" && !filepath.IsAbs(configPath) { diff --git a/pkg/io/local/client.go b/pkg/io/local/client.go index 0690f087..8a8b5154 100644 --- a/pkg/io/local/client.go +++ b/pkg/io/local/client.go @@ -47,6 +47,14 @@ func (m *Medium) path(p string) string { clean = strings.TrimLeft(clean, cutset) return filepath.Join(m.root, clean) } + // If the path is relative and the medium is rooted at "/", + // treat it as relative to the current working directory. + // This makes io.Local behave more like the standard 'os' package. + if m.root == "/" && !filepath.IsAbs(clean) { + cwd, _ := os.Getwd() + return filepath.Join(cwd, clean) + } + return filepath.Join(m.root, clean) }