Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

41878624: The trash "Put Back" feature doesn't work with programmatically trashes files #20037

Open
openradar-mirror opened this issue Jul 6, 2018 · 4 comments

Comments

@openradar-mirror
Copy link

openradar-mirror commented Jul 6, 2018

Description

Summary:
When using [NSFileManager trashItemAtURL:resultingItemURL:error:], the originating path is not stored in the .DS_Store file, causing the Put Back option not to be shown for programmatically trashed files.

Steps to Reproduce:
Create a file called foobar, then compile and run the below:

@import Foundation;

int main() {
    @autoreleasepool {
        NSFileManager *fm = [[NSFileManager alloc] init];
        NSError *err;
        NSURL *url = [NSURL fileURLWithPath:@"foobar"];
        NSURL *result;

        if (![fm trashItemAtURL:url resultingItemURL:&result error:&err]) {
            fprintf(stderr, "%s\n", err.localizedDescription.UTF8String);
            return 1;
        }

        NSLog(@"now at: %@", result);
    }

    return 0;
}

Then go to the Trash, right-click the foobar file, and notice how "Put Back" is not there.

Expected Results:
I expected the foobar file in the trash to show the Put Back context menu option.

Actual Results:
The Put Back menu item is missing and the file doesn't show up in .DS_Store.

Version:
10.14

Notes:
It's reproducible with macOS 10.14 beta 3 and all the way back to at least 10.11.

More info: sindresorhus/macos-trash#4

Product Version: 10.14
Created: 2018-07-06T04:50:32.286200
Originated: 2018-07-06T11:50:00
Open Radar Link: http://www.openradar.me/41878624

@openradar-mirror
Copy link
Author

Modified: 2018-11-08T06:57:00.460784

3 similar comments
@openradar-mirror
Copy link
Author

Modified: 2018-11-08T06:57:00.460784

@openradar-mirror
Copy link
Author

Modified: 2018-11-08T06:57:00.460784

@openradar-mirror
Copy link
Author

Modified: 2018-11-08T06:57:00.460784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant