Skip to content

feat(cli): add coder open vscode #11191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove filepath fallbacks on windows, go abs check is stricter
  • Loading branch information
mafredri committed Jan 2, 2024
commit 081a0064c55e092ec43fc74814767777fc8c7e91
11 changes: 3 additions & 8 deletions cli/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,9 @@ func waitForAgentCond(ctx context.Context, client *codersdk.Client, workspace co
return workspace, workspaceAgent, xerrors.New("watch workspace: unexpected closed channel")
}

// isWindowsAbsPath checks if the path is an absolute path on Windows. On Unix
// systems the check is very simplistic and does not cover edge cases.
// isWindowsAbsPath does a simplistic check for if the path is an absolute path
// on Windows. Drive letter or preceding `\` is interpreted as absolute.
func isWindowsAbsPath(p string) bool {
if runtime.GOOS == "windows" {
return filepath.IsAbs(p)
}

// Remove the drive letter, if present.
if len(p) >= 2 && p[1] == ':' {
p = p[2:]
Expand All @@ -259,8 +255,7 @@ func isWindowsAbsPath(p string) bool {
}

// windowsJoinPath joins the elements into a path, using Windows path separator
// and converting forward slashes to backslashes. On Unix systems a very
// simplistic join operator is used.
// and converting forward slashes to backslashes.
func windowsJoinPath(elem ...string) string {
if runtime.GOOS == "windows" {
return filepath.Join(elem...)
Expand Down