From 074e4f874f69a77fa01e0d9ed10769654a3a57d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Tue, 5 Nov 2024 16:27:14 +0900 Subject: [PATCH] fix #108: rel path resolution in windows --- cmd/um/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/um/main.go b/cmd/um/main.go index 72dc965..889b76d 100644 --- a/cmd/um/main.go +++ b/cmd/um/main.go @@ -12,7 +12,6 @@ import ( "io" "os" "os/signal" - "path" "path/filepath" "runtime" "runtime/debug" @@ -150,7 +149,7 @@ func appMain(c *cli.Context) (err error) { if inputStat.IsDir() { inputDir = input } else { - inputDir = path.Dir(input) + inputDir = filepath.Dir(input) } inputDir, absErr = filepath.Abs(inputDir) if absErr != nil { @@ -161,6 +160,7 @@ func appMain(c *cli.Context) (err error) { // Default to where the input dir is output = inputDir } + logger.Debug("resolve input/output path", zap.String("inputDir", inputDir), zap.String("input", input), zap.String("output", output)) outputStat, err := os.Stat(output) if err != nil { @@ -299,6 +299,8 @@ func (p *processor) processDir(inputDir string) error { } func (p *processor) processFile(filePath string) error { + p.logger.Debug("processFile", zap.String("file", filePath), zap.String("inputDir", p.inputDir)) + allDec := common.GetDecoder(filePath, p.skipNoopDecoder) if len(allDec) == 0 { return errors.New("skipping while no suitable decoder")