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

Add no-op implementation for android, ios, and js #18

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

kkoreilly
Copy link
Contributor

These platforms do not support trashing files, and they fail to compile with the nix implementation due to its use of x/sys/unix.

@Bios-Marcel
Copy link
Owner

Bios-Marcel commented Feb 12, 2024

Fair. Should we possibly return some kind of ErrNotSupported, allowing the app to react accordingly instead of just deleting files indefinitely?

Note, that we can make this part of the API contract, suggesting the user to manually invoke RemoveAll if desired in such case.

@kkoreilly
Copy link
Contributor Author

For my use case, I do want it to directly delete the files, but it is perfectly reasonable for me to do that manually outside of the scope of wastebasket. I will add a an ErrPlatformNotSupported global error variable and return it in the no-op implementation, assuming that is what you want me to do.

@Bios-Marcel
Copy link
Owner

Bios-Marcel commented Feb 12, 2024

Out of interest, what's your usecase for wastebasket?

@Bios-Marcel Bios-Marcel merged commit 32913f8 into Bios-Marcel:master Feb 12, 2024
9 checks passed
@kkoreilly
Copy link
Contributor Author

I am using wastebasket for a Move to trash button in the file view for my GUI framework, Cogent Core. Thanks for merging this!

@Bios-Marcel
Copy link
Owner

Bios-Marcel commented Feb 12, 2024

Oh, interesting, I wasn't aware of that project, thanks for telling.

FYI, (if i ever release it), v2 is gonna drop macos support, since macos support is basically just an invocation of finder, as the apple ecosystem doesn't offer an efficient and simple way of doing this without embedding an objective C runtime. The finder invocation has severe downsides, lagging out the PC and causing audio bugs if you trash too many files at once.

I might leave it in a legacy sub-package though 🤔

Alternatively if anyone cares, this could be moved to a third party objective C binary (there probs is some type of tashcli already) that we could add a wrapper for. It'd be nice to be able to support the big OSes without too much hassle.

@kkoreilly
Copy link
Contributor Author

We already depend on Objective C in Cogent Core (see https://github.com/cogentcore/core/blob/main/goosi/driver/desktop/desktop_darwin.m), so an Objective C implementation could be possible at some point in the future. Thanks for letting me know about the macOS situation.

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.

2 participants