File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 4
4
"context"
5
5
"fmt"
6
6
"net/url"
7
+ "path"
7
8
"path/filepath"
8
9
"strings"
9
10
@@ -106,8 +107,13 @@ func (r *RootCmd) openVSCode() *clibase.Cmd {
106
107
switch {
107
108
case len (inv .Args ) > 1 :
108
109
directory = inv .Args [1 ]
110
+
111
+ // We explicitly use `path.IsAbs` (vs `filepath`) because only
112
+ // Windows absolute paths may start without "/".
113
+ isUnixAndNotAbs := workspaceAgent .OperatingSystem != "windows" && ! path .IsAbs (directory )
114
+
109
115
// Perhaps we could SSH in to expand the directory?
110
- if ! insideThisWorkspace && strings .HasPrefix (directory , "~" ) {
116
+ if ! insideThisWorkspace && ( strings .HasPrefix (directory , "~" ) || isUnixAndNotAbs ) {
111
117
return xerrors .Errorf ("directory path %q not supported, use an absolute path instead" , directory )
112
118
}
113
119
if insideThisWorkspace {
You can’t perform that action at this time.
0 commit comments