Code Monkey home page Code Monkey logo

Comments (35)

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024 2

yes it works now! it moves it to trash dir without errors. Congrats
nice work

from superfile.

guildem avatar guildem commented on May 18, 2024 1

Issue added to xdg/trash :-)

from superfile.

yorukot avatar yorukot commented on May 18, 2024 1

Oh, thanks for checking
I didnt test it in the usb etc, i will fix it in next few day!

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024 1

yeah sure

from superfile.

yorukot avatar yorukot commented on May 18, 2024

Thanks for the information!!

I update it! xdg/trash

Update will release in v1.0.1 886dbfb

from superfile.

guildem avatar guildem commented on May 18, 2024

Nice addition, works like you did, but with the correct xdg specification. However, looking xdg/trash, seems it doesn't use the $topdir/.Trash specification to trash files from another partitions without copying them to the home trash folder. This could be a feature to implement later, or an issue to fill on xdg/trash package.

from superfile.

yorukot avatar yorukot commented on May 18, 2024

image
There's definitely something wrong with this

from superfile.

yorukot avatar yorukot commented on May 18, 2024

@guildem
What do u think about just deleting files when in the another partitions

from superfile.

guildem avatar guildem commented on May 18, 2024

Having 2 different behaviors for one action is not what I would encourage.

Moving files from other partitions to the home trash can be time consuming and take too much space (ie. small root ssd with trash and big hdd with big files to trash), but it stays coherent. All files are trashed and can be recovered.

Having trash (and recovery) on main partition and deletion on others can lead to errors when mounting multiple partitions (I have a share folder in my $HOME mounted on a 2TB HDD to store big files).

Temporary solution : a trash action and a delete action on the home partition, and only a delete action on other partitions.

Enhancement : getting trash on other partitions functional, by waiting xdg/trash to be fixed or forking it and adding yourself the functionality + PR to upstream.

Would that be a good compromise to you ?

from superfile.

yorukot avatar yorukot commented on May 18, 2024

so this is my final solution for now

Screencast.from.2024-04-08.19-20-58.webm

from superfile.

guildem avatar guildem commented on May 18, 2024

I'm not sure to understand what you've done, but maybe the better choice is to wait for the trash package to implement other trashes itself (or make a PR) ?

from superfile.

yorukot avatar yorukot commented on May 18, 2024

The method I currently use is to delete it directly if it is no longer local, but a confirmation message will be displayed before deletion.

There is no xdg in macos, so macos currently deletes it directly.

And btw i dont have any Mac so i cant test it........

from superfile.

guildem avatar guildem commented on May 18, 2024

For macos you should have this (untested) : https://github.com/Bios-Marcel/wastebasket or this https://apple.stackexchange.com/a/310084 (no lib)

Globally I stay on the position that one action giving 2 different behaviors (even with a popup) isn't great, and 2 actions could be better, one for trash, one for delete (like ranger with DD to delete and DT to trash). And if you can't trash because unimplemented for other partitions/OSes, a popup explaining why you can't

from superfile.

yorukot avatar yorukot commented on May 18, 2024

OK i will try this

But the biggest problem with macos is that I don’t have a machine to test :(
haha

from superfile.

yorukot avatar yorukot commented on May 18, 2024

@AnshumanNeon Sorry to tag you :(
Can you help me test whether the new version will throw files into the trash can on MacOs?

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

Screenshot 2024-04-16 at 9 22 54 PM
at function.go 826 you access the element of an array at index 0. but the array is empty. That means it isn't initalized. It should have at least a null value before accessing it.

from superfile.

yorukot avatar yorukot commented on May 18, 2024

Oh I know why.
You can try to regenerate hotkeys.toml
I added some hotkeys and I think that's why it's causing this error

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

I rebuilt the whole config folder. but it is showing error on deleting. and the file isn't deleted
Screenshot 2024-04-16 at 9 34 29 PM

from superfile.

yorukot avatar yorukot commented on May 18, 2024

Ok thanks for your testing!
Can you send it back to me to see the contents of superfile.log?
Should be in ~/.cache/superfile

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024
2024/04/14 14:43:41 err when open file with xdg-open:
2024/04/14 14:43:41 exec: "xdg-open": executable file not found in $PATH
2024/04/16 21:33:57 Delete single item function move file to trash can error
2024/04/16 21:33:57 exit status 1
2024/04/16 21:34:21 Delete single item function move file to trash can error
2024/04/16 21:34:21 exit status 1
2024/04/16 21:38:39 Delete single item function move file to trash can error
2024/04/16 21:38:39 exit status 1

superfile.log logs. so you are trying to call "xdg-open" which is a program that needs to be installed?

from superfile.

yorukot avatar yorukot commented on May 18, 2024
// ...
	} else if len(panel.element) > 0 && !panel.element[panel.cursor].directory {
		cmd := exec.Command("xdg-open", panel.element[panel.cursor].location)
		_, err := cmd.Output()
		if err != nil {
			outPutLog("err when open file with xdg-open:", err)
		}
	}
// ...
}
2024/04/14 14:43:41 err when open file with xdg-open:
2024/04/14 14:43:41 exec: "xdg-open": executable file not found in $PATH

I think this is another error.

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

https://superuser.com/a/913226
as mentioned in this answer, you should probably use "open" command for darwin

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024
2024/04/16 21:52:09 Delete single item function move file to trash can error
2024/04/16 21:52:09 exit status 1

this is the error when trying again after installing xdg-utils

from superfile.

yorukot avatar yorukot commented on May 18, 2024

Ok i got it.
I'll fix it in 7d03edf

And about the Macos trash can, I think I'll fix it tomorrow :(

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

no problem

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

@MHNightCat i found a really easy solution. It is in this thread https://apple.stackexchange.com/a/310084 mentioned by @guildem
I am talking about this specific solution: https://apple.stackexchange.com/a/335164
it is easy and cheap and it works on my mac.

from superfile.

yorukot avatar yorukot commented on May 18, 2024

bb55ece
Thanks for responding, I already updated it!

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

but this is what is already there. That osascript isn't working.

from superfile.

yorukot avatar yorukot commented on May 18, 2024

Oh~ ok got it i will update again!

from superfile.

yorukot avatar yorukot commented on May 18, 2024

@AnshumanNeon I update it in 5dfbcb9

from superfile.

yorukot avatar yorukot commented on May 18, 2024

Does this work?
I think after this fix this issue i will release v1.1.0

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

no it doesn't. Here is the log:

2024/04/19 17:14:01 Delete single item function move file to trash can error
2024/04/19 17:14:01 exit status 1

from superfile.

AnshumanNeon avatar AnshumanNeon commented on May 18, 2024

sorry for being late

from superfile.

yorukot avatar yorukot commented on May 18, 2024

It's fine!
I update it again in d34ee13
Could you please give it a try?

from superfile.

yorukot avatar yorukot commented on May 18, 2024

OK, thanks for testing!

I close this issue for now.
But if you have any better ideas about this, feel free to reopen

still can’t put the files on the external hard drive into the trash btw

from superfile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.