Browse Source

fix: use gio as default linux trash impl (backport: 3-0-x) (#15421)

* fix: use gio as default linux trash impl

* doc: add ELECTRON_TRASH env var
trop[bot] 6 years ago
parent
commit
b6b9966162
2 changed files with 15 additions and 4 deletions
  1. 5 4
      atom/common/platform_util_linux.cc
  2. 10 0
      docs/api/environment-variables.md

+ 5 - 4
atom/common/platform_util_linux.cc

@@ -15,7 +15,7 @@
 #include "url/gurl.h"
 
 #define ELECTRON_TRASH "ELECTRON_TRASH"
-#define ELECTRON_DEFAULT_TRASH "gvfs-trash"
+#define ELECTRON_DEFAULT_TRASH "gio"
 
 namespace {
 
@@ -126,12 +126,13 @@ bool MoveItemToTrash(const base::FilePath& full_path) {
   } else if (trash.compare("trash-cli") == 0) {
     argv.push_back("trash-put");
     argv.push_back(full_path.value());
-  } else if (trash.compare("gio") == 0) {
-    argv.push_back("gio");
-    argv.push_back("trash");
+  } else if (trash.compare("gvfs-trash") == 0) {
+    // retain support for deprecated gvfs-trash
+    argv.push_back("gvfs-trash");
     argv.push_back(full_path.value());
   } else {
     argv.push_back(ELECTRON_DEFAULT_TRASH);
+    argv.push_back("trash");
     argv.push_back(full_path.value());
   }
   return XDGUtilV(argv, true);

+ 10 - 0
docs/api/environment-variables.md

@@ -58,6 +58,16 @@ Don't attach to the current console session.
 
 Don't use the global menu bar on Linux.
 
+### `ELECTRON_TRASH` _Linux_
+
+Set the trash implementation on Linux. Default is `gio`.
+
+Options:
+* `gvfs-trash`
+* `trash-cli`
+* `kioclient5`
+* `kioclient`
+
 ## Development Variables
 
 The following environment variables are intended primarily for development and