Bug 492725 - Show In->System Explorer on docker volume is not working
- change ShowInSystemExplorerCommandHandler to figure out if the
file to look at is a directory or file and calculate the appropriate
working directory when needed
Change-Id: If941f668cc894fbd714865a81f90f43b9eacad54
Reviewed-on: https://git.eclipse.org/r/76176
Tested-by: Hudson CI
Reviewed-by: Xavier Coulon <xcoulon@redhat.com>
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/ShowInSystemExplorerCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/ShowInSystemExplorerCommandHandler.java
index a8a7e89..a26eb82 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/ShowInSystemExplorerCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/ShowInSystemExplorerCommandHandler.java
@@ -95,11 +95,13 @@
*/
private Process getLaunchProcess(final String launchCmd, final File dir)
throws IOException {
+ File workingDir = dir.isDirectory() ? dir : dir.getParentFile();
if (Util.isLinux() || Util.isMac()) {
return Runtime.getRuntime().exec(
- new String[] { "/bin/sh", "-c", launchCmd }, null, dir); //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { "/bin/sh", "-c", launchCmd }, null, //$NON-NLS-1$ //$NON-NLS-2$
+ workingDir);
} else {
- return Runtime.getRuntime().exec(launchCmd, null, dir);
+ return Runtime.getRuntime().exec(launchCmd, null, workingDir);
}
}