Skip to content

DownloadQueue: log full path on ed2k-link duplicate - #172

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/duplicate-log-fullpath
Jun 16, 2026
Merged

DownloadQueue: log full path on ed2k-link duplicate#172
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/duplicate-log-fullpath

Conversation

@got3nks

@got3nks got3nks commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Closes #168.

The "You already have the file '%s'" log line printed only the bare filename when an ed2k:// link resolved to a file already in the user's shared set. Stoatwblr's report on #168: when the local file has been renamed (or lives in a non-default shared root), the bare filename in the log doesn't tell the user where to actually find it on disk.

The full path is already computed two lines above the log site in DownloadQueue.cpp:385 for the FileExists() existence check, so the fix is a one-liner — swap file->GetFileName() for fullpath in the CFormat:

-AddLogLineC(CFormat( _("You already have the file '%s'") ) % file->GetFileName());
+AddLogLineC(CFormat( _("You already have the file '%s'") ) % fullpath);

Output goes from You already have the file 'XYZ.avi' to You already have the file '/home/user/Music/XYZ.avi'. The basename is still in the formatted string (tail of the path), so existing log greps for the filename keep matching.

The msgid stays byte-identical, so po/amule.pot and the 40 po/*.po catalogs are untouched and translators don't get a fuzzy entry.

Scope limit

IsFileExisting only receives the MD4 hash, not the ed2k-link filename the user clicked. Stoat's example showed both names (link name "as" local name); plumbing the link filename through every caller would be a much bigger change for a log-line tweak. Showing the on-disk path solves the "can't find the file" problem on its own.

Test plan

  • Build clean on macOS arm64 (Homebrew, Release).
  • User confirmation: clicking an ed2k:// link for a file already in the shared set logs the absolute path of the on-disk copy.

The "You already have the file '%s'" log line printed only the bare
filename, which made the file hard to locate on disk when the user
had renamed it locally or had several shared roots. The full path is
already computed two lines above for the existence check; just pass
that to CFormat instead of the bare filename.

Output goes from
  You already have the file 'XYZ.avi'
to
  You already have the file '/home/user/Music/XYZ.avi'

The basename is still present in the formatted string (it's the tail
of the path), so existing log greps for the filename still match.
The msgid stays byte-identical so .pot/.po catalogs are untouched.

Closes amule-project#168
@got3nks
got3nks merged commit cafaabb into amule-org:master Jun 16, 2026
10 checks passed
@got3nks
got3nks deleted the fix/duplicate-log-fullpath branch June 17, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enh: Logger tweak, adding duplicate ed2k

1 participant