From 3b5e3eeacec7fc433d132e6eb28130139874a1d9 Mon Sep 17 00:00:00 2001 From: Daniel Milde Date: Tue, 23 Nov 2021 15:15:23 +0100 Subject: [PATCH] convert path to absolute before checking crossing mountpoints fixes #106 --- cmd/gdu/app/app.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/gdu/app/app.go b/cmd/gdu/app/app.go index 9d3371bb5..0c817011d 100644 --- a/cmd/gdu/app/app.go +++ b/cmd/gdu/app/app.go @@ -96,6 +96,8 @@ func (a *App) Run() (err error) { log.Printf("Runtime flags: %+v", *a.Flags) path := a.getPath() + path, _ = filepath.Abs(path) + ui, err = a.createUI() if err != nil { return @@ -233,19 +235,17 @@ func (a *App) runAction(ui UI, path string) error { return fmt.Errorf("reading analysis: %w", err) } } else { - abspath, _ := filepath.Abs(path) - if build.RootPathPrefix != "" { - abspath = build.RootPathPrefix + abspath + path = build.RootPathPrefix + path } - _, err := a.PathChecker(abspath) + _, err := a.PathChecker(path) if err != nil { return err } - log.Printf("Analyzing path: %s", abspath) - if err := ui.AnalyzePath(abspath, nil); err != nil { + log.Printf("Analyzing path: %s", path) + if err := ui.AnalyzePath(path, nil); err != nil { return fmt.Errorf("scanning dir: %w", err) } }