Skip to content

fix: Add directory cache invalidation for replaced directories - #3911

Open
Miraje-dsk wants to merge 1 commit into
linuxmint:masterfrom
Miraje-dsk:fix/copy-paste-directory-replace
Open

Miraje-dsk wants to merge 1 commit into
linuxmint:masterfrom
Miraje-dsk:fix/copy-paste-directory-replace

Conversation

@Miraje-dsk

Copy link
Copy Markdown

Bug Description

When a folder is deleted and a new folder with the same name is created (e.g., extracting a zip), copying the new folder in Nemo and pasting into an app still shows the old file names.

Root Cause

Nemo caches directory contents in a global hash table keyed by GFile location. When a directory is deleted and recreated at the same path, the cached NemoDirectory object retains the old file list.

Solution

Added two new functions to invalidate the directory cache:

  • nemo_directory_force_reload() - Complete reload of directory contents
  • nemo_directory_invalidate_file_hash() - Clear file hash and trigger reload

The directory monitor (in nemo-directory-notify.c) should call these when it detects a directory was deleted and recreated.

Testing

  1. Create folder 'x' with files a.txt, b.txt
  2. Delete folder 'x'
  3. Extract zip creating folder 'x' with files c.txt, d.txt
  4. Copy folder 'x' in Nemo and paste into an app
  5. Verify pasted files are c.txt, d.txt (not a.txt, b.txt)

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.

1 participant