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

Go to source doesn't work with absolute windows paths #11

Closed
melak47 opened this Issue Sep 4, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@melak47

melak47 commented Sep 4, 2018

When the file for a test case or suite is given as an absolute windows path, e.g. d:\src\test.cpp, fileToUri in util.ts parses it as an URI with scheme "d" instead of a file path, which then can't be opened.

A workaround could be:

const schemeMatcher = /^[a-z][a-z0-9+-.]*:/;
const winpathMatcher = /^[a-zA-Z]:\\/;
export function fileToUri(file: string): vscode.Uri {
	if (!winpathMatcher.test(file) && schemeMatcher.test(file)) {
		return vscode.Uri.parse(file);
	} else {
		return vscode.Uri.file(file);
	}
}

This should work as long as no test adapter produces absolute paths with forward slashes on windows...

@hbenl

This comment has been minimized.

Show comment
Hide comment
@hbenl

hbenl Sep 4, 2018

Owner

I went for an even simpler workaround: I changed the schemeMatcher to require URL schemes to have at least 2 characters (I've never seen a scheme with just one character). I'll publish when the marketplace is back online.
Thanks for reporting this.

Owner

hbenl commented Sep 4, 2018

I went for an even simpler workaround: I changed the schemeMatcher to require URL schemes to have at least 2 characters (I've never seen a scheme with just one character). I'll publish when the marketplace is back online.
Thanks for reporting this.

@hbenl hbenl closed this Sep 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment