Skip to content

Commit

Permalink
Merge pull request #2185 from posit-dev/sagerb-fix-path-for-edit-conf…
Browse files Browse the repository at this point in the history
…iguration-on-windows

Switch to properly use `Uri.file()` rather than `Uri.parse()`.
  • Loading branch information
sagerb authored Aug 28, 2024
2 parents 6f10801 + 986359b commit 71c238a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions extensions/vscode/src/utils/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export async function openNewOrExistingFileInPreview(
appendedContents?: string,
) {
let fileExist = true;
const existingUri = Uri.parse(filePath);
const existingUri = Uri.file(filePath);
const newUri = Uri.file(filePath).with({ scheme: "untitled" });

try {
Expand Down Expand Up @@ -123,7 +123,7 @@ export async function updateNewOrExistingFile(
openEditor = false,
) {
let fileExist = true;
const uri = Uri.parse(filePath);
const uri = Uri.file(filePath);

try {
await workspace.fs.stat(uri);
Expand Down Expand Up @@ -263,7 +263,7 @@ export function relativePath(uri: Uri): string | undefined {
return undefined;
}
const base = uriUtils.basename(uri);
const relativeFilePath = uriUtils.joinPath(Uri.parse(relativeDirPath), base);
const relativeFilePath = uriUtils.joinPath(Uri.file(relativeDirPath), base);
let result = relativeFilePath.path;
if (result.startsWith(path.sep)) {
result = result.replace(path.sep, "");
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
if (config) {
return await commands.executeCommand(
"vscode.open",
Uri.parse(config.configurationPath),
Uri.file(config.configurationPath),
);
}
console.error(
Expand Down

0 comments on commit 71c238a

Please sign in to comment.