You can’t know that before trying. It’s not an issue of file system types: remote file systems might not support a trash folder, or the file system is read only. That’s why it’s a recoverable error.
As a side note, your code example is wrong. You should not only check the error code, but also the error domain, as the code is a mere integer value, and it can be the same across different domains. Use g_error_matches() with the G_IO_ERROR domain and the G_IO_ERROR_NOT_SUPPORTED code, instead.
You can’t know that before trying. It’s not an issue of file system types: remote file systems might not
support a trash folder, or the file system is read only. That’s why it’s a recoverable error.
OK.
As a side note, your code example is wrong. You should not only check the error code, but also the error domain, as the code is a mere integer value, and it can be the same across different domains. Use g_error_matches() with the G_IO_ERROR domain and the G_IO_ERROR_NOT_SUPPORTED code, instead.
Also, my understanding is that in this case function returns TRUE as its a recoverable error, correct? All other cases do return FALSE, indicating the actual trashing failure.
If you’re using just the return value without passing a GError, you will get FALSE on any error, including violations of the precondition checks.
If you’re passing a GError pointer, then you can simply check the GError: in all cases where the GError is set, the return value is FALSE. If the function returns FALSE without setting a GError is, generally speaking, a bug worthy of being filed.