1818 */
1919package org .netbeans .modules .dlight .terminal .action ;
2020
21- import java .io .File ;
2221import java .net .MalformedURLException ;
2322import java .net .URL ;
2423import java .util .ArrayList ;
2827import org .netbeans .lib .terminalemulator .Term ;
2928import org .netbeans .modules .nativeexecution .api .ExecutionEnvironment ;
3029import org .netbeans .modules .nativeexecution .api .ExecutionEnvironmentFactory ;
31- import org .netbeans .modules .nativeexecution .api .util .HostInfoUtils ;
30+ import org .netbeans .modules .nativeexecution .api .util .WindowsSupport ;
3231import org .netbeans .modules .terminal .spi .ui .ExternalCommandActionProvider ;
3332import org .netbeans .modules .terminal .support .OpenInEditorAction ;
34- import org .openide .filesystems .FileObject ;
35- import org .openide .filesystems .FileUtil ;
36- import org .openide .filesystems .URLMapper ;
37- import org .openide .util .Exceptions ;
33+ import org .openide .util .BaseUtilities ;
3834import org .openide .util .Lookup ;
3935import org .openide .util .lookup .ServiceProvider ;
4036
@@ -83,12 +79,14 @@ public void handle(String command, Lookup lookup) {
8379
8480 Object key = lookup .lookup (Term .class ).getClientProperty (Term .ExternalCommandsConstants .EXECUTION_ENV_PROPERTY_KEY );
8581 URL url = null ;
82+ boolean remoteShell = false ;
8683 try {
8784
8885 if (key instanceof String ) {
8986 ExecutionEnvironment env = ExecutionEnvironmentFactory .fromUniqueID ((String ) key );
9087 if (env .isRemote ()) {
9188 url = new URL ("rfs://" + key + filePath ); //NOI18N
89+ remoteShell = true ;
9290 }
9391
9492 }
@@ -99,6 +97,12 @@ public void handle(String command, Lookup lookup) {
9997 if (url != null ) {
10098 OpenInEditorAction .post (url , lineNumber );
10199 } else {
100+ if (!remoteShell && BaseUtilities .isWindows ()) {
101+ // NetBeans only supports shells running via cygwin/msys
102+ // the paths then need to be converted to basic windows
103+ // paths
104+ filePath = WindowsSupport .getInstance ().convertToWindowsPath (filePath );
105+ }
102106 OpenInEditorAction .post (filePath , lineNumber );
103107 }
104108 }
0 commit comments