Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit05bb621

Browse files
chore: ensure we use unix path
1 parent2061044 commit05bb621

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

‎cli/open.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ func buildVSCodeWorkspaceDevContainerLink(
428428
containerNamestring,
429429
containerFolderstring,
430430
) (*url.URL, url.Values) {
431+
containerFolder=windowsToUnixPath(containerFolder)
432+
431433
qp:= url.Values{}
432434
qp.Add("url",clientURL)
433435
qp.Add("owner",workspace.OwnerName)
@@ -520,6 +522,10 @@ func unixToWindowsPath(p string) string {
520522
returnstrings.ReplaceAll(p,"/","\\")
521523
}
522524

525+
funcwindowsToUnixPath(pstring)string {
526+
returnstrings.ReplaceAll(p,"\\","/")
527+
}
528+
523529
// resolveAgentAbsPath resolves the absolute path to a file or directory in the
524530
// workspace. If the path is relative, it will be resolved relative to the
525531
// workspace's expanded directory. If the path is absolute, it will be returned

‎cli/open_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,6 @@ func TestOpenVSCode_NoAgentDirectory(t *testing.T) {
185185
wd,err:=os.Getwd()
186186
require.NoError(t,err)
187187

188-
absPath:="/home/coder"
189-
ifruntime.GOOS=="windows" {
190-
absPath="C:\\home\\coder"
191-
}
192-
193188
tests:= []struct {
194189
namestring
195190
args []string
@@ -210,8 +205,8 @@ func TestOpenVSCode_NoAgentDirectory(t *testing.T) {
210205
},
211206
{
212207
name:"ok with absolute path",
213-
args: []string{"--test.open-error",workspace.Name,absPath},
214-
wantDir:absPath,
208+
args: []string{"--test.open-error",workspace.Name,"/home/coder"},
209+
wantDir:"/home/coder",
215210
},
216211
{
217212
name:"ok with token",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp