[geany/geany-plugins] 1e2f19: Project Organizer: Use system trash for file/folder removal

xiota git-noreply at xxxxx
Sun Jan 30 21:18:06 UTC 2022


Branch:      refs/heads/master
Author:      xiota <github at mentalfossa.com>
Committer:   xiota <github at mentalfossa.com>
Date:        Wed, 20 Oct 2021 12:31:18 UTC
Commit:      1e2f19f979e7b7548c5d65c266513c961071598c
             https://github.com/geany/geany-plugins/commit/1e2f19f979e7b7548c5d65c266513c961071598c

Log Message:
-----------
Project Organizer: Use system trash for file/folder removal


Modified Paths:
--------------
    projectorganizer/src/prjorg-utils.c

Modified: projectorganizer/src/prjorg-utils.c
9 lines changed, 8 insertions(+), 1 deletions(-)
===================================================================
@@ -149,9 +149,16 @@ gboolean create_dir(char *utf8_name)
 
 gboolean remove_file_or_dir(char *utf8_name)
 {
+	gboolean ret = FALSE;
 	gchar *name = utils_get_locale_from_utf8(utf8_name);
-	gboolean ret = g_remove(utf8_name) == 0;
+
+	GFile *file = g_file_new_for_path(name);
+	ret = g_file_trash(file, NULL, NULL);
+	if (!ret)
+		ret = g_file_delete(file, NULL, NULL);
+
 	g_free(name);
+	g_object_unref(file);
 	return ret;
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list