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

OS move_to_trash() on Linux is not compliant with the Freedesktop specification #42840

Closed
chucklepie opened this issue Oct 15, 2020 · 6 comments · Fixed by #44021
Closed

OS move_to_trash() on Linux is not compliant with the Freedesktop specification #42840

chucklepie opened this issue Oct 15, 2020 · 6 comments · Fixed by #44021

Comments

@chucklepie
Copy link

chucklepie commented Oct 15, 2020

Godot version:
3.2.2 stable

OS/device including version:
Linux mint

Issue description:
In Godot modifying files externally is generally a bad idea as things may break inside Godot, so the approach is to use the IDE.

Unlike almost most IDEs, when you select DELETE on an item in the FileSystem dock they are removed permanently (yes, I know there is a message saying this), they are not removed to the current operating system Trash.

This is quite a dangerous thing and all other editors simply send the files to the Trash. I know this because I decided to tidy up some files before committing and accidentally deleted all the files I had created and worked on in the past few hours as I'd selected a couple by mistake.

Steps to reproduce:

  1. create a file
  2. Use Godot to delete it
  3. No getting it back
@Calinou Calinou changed the title Godot file delete operation does not follow standard file deletion procedures Removing a file in the FileSystem dock doesn't move it to the Trash as expected Oct 15, 2020
@Calinou
Copy link
Member

Calinou commented Oct 15, 2020

they are not removed to the current operating system Trash.

This is supposed to happen, but it's not working for some reason: #41263

It works here with Godot 3.2.3 and Fedora 32 KDE.

@chucklepie
Copy link
Author

chucklepie commented Oct 15, 2020

Right, time to apologise, but I think there's still a little bug ;)

Looks like what has happened is I didn't find the files because for some reason when I delete from Godot the Trash items do not have a timestamp and I was sorting by date. Is this a known thing? because deleting from everything else (e.g. file manager, vscode, graphics tools, etc) adds date/time but inside Godot the stamp is left out - I've just tested it and it's consistently doing this.

image

@Anutrix
Copy link
Contributor

Anutrix commented Oct 25, 2020

@chucklepie I suggest you rename the issue title.
Godot moves the deleted files to trash can using mv command (

err = execute("mv", mv_args, true, nullptr, nullptr, &retval);
).
Not sure why the timestamps would be effected. It's most probably a file manager issue.

@akien-mga akien-mga changed the title Removing a file in the FileSystem dock doesn't move it to the Trash as expected Removing a file in the FileSystem dock moves it to trash but without valid timestamp Nov 16, 2020
@akien-mga akien-mga changed the title Removing a file in the FileSystem dock moves it to trash but without valid timestamp OS move_to_trash() on Linux is not compliant with the Freedesktop specification Nov 16, 2020
@akien-mga
Copy link
Member

As seen in #41263, the problem is that our implementation of OS::move_to_trash() for Linux/*BSD (in platform/linuxbsd/os_linuxbsd.cpp) does not generate .trashinfo files that describe the trashed files and can be used to restore them.

The implementation should be reviewed to ensure that it follows the Freedesktop Trash specification.

Here's our relevant code:

Error OS_LinuxBSD::move_to_trash(const String &p_path) {

@akien-mga akien-mga added this to the 4.0 milestone Nov 16, 2020
dakennedyd added a commit to dakennedyd/godot that referenced this issue Dec 7, 2020
Fixes godotengine#42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification
@dalexeev
Copy link
Member

The issue is still not fixed in 3.2.4.beta6.official.

@Calinou
Copy link
Member

Calinou commented Jan 26, 2021

@dalexeev #44021 needs to be remade for the 3.2 branch to fix it there.

akien-mga pushed a commit to akien-mga/godot that referenced this issue Jul 15, 2021
Fixes godotengine#42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification

(cherry picked from commit 8b68c68)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants