diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-17 10:15:45 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-17 10:15:45 +0200 |
| commit | a2cb20851499e9c00bd3bf642680a9ce3148cae8 (patch) | |
| tree | 09ef80b9662308b758a88ed2f43078c92e525f29 /internal/engine/facts.go | |
| parent | 47b6776c2cb9b017ad95acb5aae8e34b8776fc7c (diff) | |
| download | krino-a2cb20851499e9c00bd3bf642680a9ce3148cae8.tar.gz krino-a2cb20851499e9c00bd3bf642680a9ce3148cae8.zip | |
gui: name the other copy of a duplicate, and offer to keep this one instead
Diffstat (limited to 'internal/engine/facts.go')
| -rw-r--r-- | internal/engine/facts.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/engine/facts.go b/internal/engine/facts.go index 641f1ef..ce05df4 100644 --- a/internal/engine/facts.go +++ b/internal/engine/facts.go @@ -158,6 +158,10 @@ type facts struct { // could not read), so (matched) is unknown while none has matched. undecided bool + // dupOriginal is the file a (duplicate) test last matched against, + // absolute, for a front end that offers to act on the other copy. + dupOriginal string + contentDone bool // extraction was attempted contentErr error // why it failed partialErr error // extract.ErrPartial: a keyword not found may be in the unread part @@ -290,9 +294,17 @@ func (f *facts) Duplicate(dirs []string) (string, bool, error) { if !isDup { return "", false, nil } + // The absolute path is kept for a front end that has to act on the + // other copy - the window offers to keep this one instead - while the + // reason text stays as it reads best (plan 21). + f.dupOriginal = orig return displayOriginal(orig, root), true, nil } +// DuplicateOriginal is the file the last (duplicate) test matched against, +// absolute; "" when none did. +func (f *facts) DuplicateOriginal() string { return f.dupOriginal } + // displayOriginal reports orig relative to root when it lies inside root, // else home-abbreviated (xdg.Abbrev), as every other user-visible path is. func displayOriginal(orig, root string) string { |
