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() not functioning or poorly documented #61942

Closed
NationalityNZ opened this issue Jun 11, 2022 · 11 comments · Fixed by #61945
Closed

OS.move_to_trash() not functioning or poorly documented #61942

NationalityNZ opened this issue Jun 11, 2022 · 11 comments · Fixed by #61945

Comments

@NationalityNZ
Copy link

NationalityNZ commented Jun 11, 2022

Godot version

4.0 Alpha 9

System information

Windows 10

Issue description

Using OS.move_to_trash always produces a generic failure (error code 1). This could be due to my windows configuration, or it could also be due to a bug, or it could be because OS.move_to_trash() is very minimally documented.

Steps to reproduce

Run the project and click the button.

func _on_button_pressed():
	var result = OS.move_to_trash("res://test.txt")
	print(result)

Minimal reproduction project

Move_To_TrashProject.zip

@Calinou
Copy link
Member

Calinou commented Jun 11, 2022

Can you reproduce this on 3.4.4 3.5rc3?

Did you disable the system trash in your Windows settings, or did you set a file size limit on it?

@NationalityNZ
Copy link
Author

I can manually send files to the recycling bin, which I suppose means it is not disabled and not file size limited. My recycling bin is on a different hard drive from my godot projects if that makes a difference.

@Calinou
Copy link
Member

Calinou commented Jun 11, 2022

My recycling bin is on a different hard drive from my godot projects if that makes a difference.

This could be the cause of the issue. Can you reproduce this issue on a project created on the same hard drive?

Also, is your recycle bin on the C: drive or another drive?

@NationalityNZ
Copy link
Author

My recycle bin is in the default location C:
Also, 3.4.4 apparently doesn't have OS.move_to_trash()
I will test whether putting it on the same directory helps.

@NationalityNZ
Copy link
Author

I put a test project on the same drive as the recycling bin and unfortunately it didn't work. This was a new project.

@Calinou
Copy link
Member

Calinou commented Jun 11, 2022

Also, 3.4.4 apparently doesn't have OS.move_to_trash()

It's only exposed to scripting since 3.5rc3: #60542

@bruvzg
Copy link
Member

bruvzg commented Jun 11, 2022

move_to_trash do not globalize path, therefore require a full real path (like c:/something/). Since res:// in the exported project point to the contents of read only PCK, move_to_trash on res://something is not valid use anyway. But probably it should be considered a bug since it should be usable on user:// files.

Edit: removed Windows label, it seems to be the same on macOS and Linux.

@Torguen
Copy link

Torguen commented Oct 6, 2022

This is also happening on Android.
godot version v3.5.1.stable.official [6fed1ff]

@Calinou
Copy link
Member

Calinou commented Oct 6, 2022

This is also happening on Android. godot version v3.5.1.stable.official [6fed1ff]

Please open a new issue with a minimal reproduction project attached.

@Torguen
Copy link

Torguen commented Oct 7, 2022

This is also happening on Android. godot version v3.5.1.stable.official [6fed1ff]

Please open a new issue with a minimal reproduction project attached.

Do I have to upload a tscn file?
apk?
?¿?

@Calinou
Copy link
Member

Calinou commented Oct 7, 2022

Do I have to upload a tscn file?
apk?
?¿?

A minimal reproduction project is a ZIP archive that contains all the project files, including project.godot. It should be able to be imported and run directly in the project manager.

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

Successfully merging a pull request may close this issue.

6 participants