Details about trash implementation

Hi,

I’m writing a pet project implementing the Freedesktop.org Trash specification. I’m using the Gnome Files implementation for pointers, and noticed how it handles files/directories with the same name by adding an integer suffix. I was trying to look up the source code for this, but I can’t find the right place, beyond g_file_trash() in gio/gfile.c [1]. Can someone with knowledge in this area guide me to the correct place (I’m working with very basic C experience)?

I’m specifically looking for implementation details on this suffix and if there’s a ceiling to that value.

[1] - gio/gfile.c · main · GNOME / GLib · GitLab

Thanks!

Hi, what you’re looking for is in the implementation of the used interface: gio/glocalfile.c · main · GNOME / GLib · GitLab

1 Like

Thanks!!
Am I reading that part wrong, or does that code say there’s no ceiling for that integer suffix? It looks like the loop condition only checks the file open status and an error result.

Indeed there doesn’t seem to be an upper limit for the integer.

Thanks for the clarification!! Helped me a lot.

Btw, my code is at GitHub - chamilad/trash-rs: A freedesktop.org trash spec implementation in Rust. It’s a side project with main objective to learn rust incrementally. But I intend to bring it to a usable state.