File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ export function resolveVariables(
275275 * @returns absolute path relative to the workspace root
276276 */
277277export function pathRelToAbs ( relPath : string , uri : vscode . Uri ) : string | undefined {
278+ if ( path . isAbsolute ( relPath ) ) return relPath ;
278279 const root = getOuterMostWorkspaceFolder ( vscode . workspace . getWorkspaceFolder ( uri ) ) ;
279280 if ( root === undefined ) return undefined ;
280281 return path . join ( root . uri . fsPath , relPath ) ;
Original file line number Diff line number Diff line change @@ -54,10 +54,15 @@ suite('Tools tests', () => {
5454 test ( 'Resolve local paths: undefined' , ( ) => {
5555 const root = Uri . parse ( '/home/user/project' ) ;
5656 const absPath = pathRelToAbs ( './sample.f90' , root ) ;
57- console . log ( absPath , root ) ;
5857 assert . strictEqual ( absPath , undefined ) ;
5958 } ) ;
6059
60+ test ( 'Resolve local paths: absolute' , ( ) => {
61+ const root = Uri . parse ( '/home/user/project' ) ;
62+ const absPath = pathRelToAbs ( path . resolve ( process . cwd ( ) ) , root ) ;
63+ assert . strictEqual ( absPath , path . resolve ( process . cwd ( ) ) ) ;
64+ } ) ;
65+
6166 test ( 'Resolve local paths: workspace selection' , ( ) => {
6267 const root = Uri . parse ( path . resolve ( __dirname , '../../../test/fortran' ) ) ;
6368 const absPath = pathRelToAbs ( './sample.f90' , root ) ;
You can’t perform that action at this time.
0 commit comments