From 3bbe54bb719cf40b477161fd6486916c1da1828e Mon Sep 17 00:00:00 2001 From: zlsun Date: Fri, 20 Jun 2014 17:34:01 +0800 Subject: [PATCH 1/2] Change cwd to %HOME% before executing command. --- Wox.Infrastructure/WindowsShellRun.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Wox.Infrastructure/WindowsShellRun.cs b/Wox.Infrastructure/WindowsShellRun.cs index 73627d1a24..1318dab303 100644 --- a/Wox.Infrastructure/WindowsShellRun.cs +++ b/Wox.Infrastructure/WindowsShellRun.cs @@ -297,6 +297,9 @@ namespace Wox.Infrastructure int driveId = -1; if (PromptForMedia(cmd, out driveId)) { + string oldCwd = Environment.CurrentDirectory; + string home = Environment.GetEnvironmentVariable("HOME"); + Environment.CurrentDirectory = home; ShellExecCmdLine( IntPtr.Zero, errorDialogHwnd, @@ -305,6 +308,7 @@ namespace Wox.Infrastructure global::System.Diagnostics.ProcessWindowStyle.Normal, ShellExecCmdLineFlags.SECL__IGNORE_ERROR | ShellExecCmdLineFlags.SECL_USE_IDLIST | ShellExecCmdLineFlags.SECL_LOG_USAGE | (showErrorDialog ? 0 : ShellExecCmdLineFlags.SECL_NO_UI) ); + Environment.CurrentDirectory = oldCwd; } else { // Device not ready 0x80070015 From 132d5ec8ccf77e6c1bf92c2ea3e2f26eedd40212 Mon Sep 17 00:00:00 2001 From: zlsun Date: Mon, 30 Jun 2014 22:38:51 +0800 Subject: [PATCH 2/2] Revert "Use sleep instead of ping." This reverts commit 3f1064b22d4ebb2223a9e82cd0a59c0191e6dc13. --- Wox.Plugin.SystemPlugins/Sys.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wox.Plugin.SystemPlugins/Sys.cs b/Wox.Plugin.SystemPlugins/Sys.cs index ec48fbea7c..c4fdb5561f 100644 --- a/Wox.Plugin.SystemPlugins/Sys.cs +++ b/Wox.Plugin.SystemPlugins/Sys.cs @@ -94,7 +94,7 @@ namespace Wox.Plugin.SystemPlugins Action = (c) => { ProcessStartInfo Info = new ProcessStartInfo(); - Info.Arguments = "/C sleep 1 && \"" + Application.ExecutablePath + "\""; + Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\""; Info.WindowStyle = ProcessWindowStyle.Hidden; Info.CreateNoWindow = true; Info.FileName = "cmd.exe";