Merge pull request #8528 from Anatzum/patch-1
Use kioclient for MoveItemToTrash on KDE
This commit is contained in:
commit
7265a0c1b4
1 changed files with 14 additions and 1 deletions
|
@ -7,7 +7,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "base/cancelable_callback.h"
|
#include "base/cancelable_callback.h"
|
||||||
|
#include "base/environment.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
|
#include "base/nix/xdg_util.h"
|
||||||
#include "base/process/kill.h"
|
#include "base/process/kill.h"
|
||||||
#include "base/process/launch.h"
|
#include "base/process/launch.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
@ -99,9 +101,20 @@ bool MoveItemToTrash(const base::FilePath& full_path) {
|
||||||
std::string trash;
|
std::string trash;
|
||||||
if (getenv(ELECTRON_TRASH) != NULL) {
|
if (getenv(ELECTRON_TRASH) != NULL) {
|
||||||
trash = getenv(ELECTRON_TRASH);
|
trash = getenv(ELECTRON_TRASH);
|
||||||
|
} else {
|
||||||
|
// Determine desktop environment and set accordingly.
|
||||||
|
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||||
|
base::nix::DesktopEnvironment desktop_env(
|
||||||
|
base::nix::GetDesktopEnvironment(env.get()));
|
||||||
|
if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
|
||||||
|
desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
|
||||||
|
trash = "kioclient5";
|
||||||
|
} else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3) {
|
||||||
|
trash = "kioclient";
|
||||||
} else {
|
} else {
|
||||||
trash = ELECTRON_DEFAULT_TRASH;
|
trash = ELECTRON_DEFAULT_TRASH;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> argv;
|
std::vector<std::string> argv;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue