File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ describe('Path Type Tests', async () => {
5252 await vscode . window . showNotebookDocument ( notebook ) ;
5353 await vscode . workspace . getConfiguration ( 'jsonpath-notebook' ) . update ( 'useRelativePaths' , true , true ) ;
5454
55- const contextUri = vscode . Uri . file ( 'C :\\input\\bookstore.json' ) ;
55+ const contextUri = vscode . Uri . file ( 'Z :\\input\\bookstore.json' ) ;
5656
5757 const expectedPath = contextUri . path ;
5858 const actualPath = getPreferredPathFormatFromUri ( contextUri ) ;
Original file line number Diff line number Diff line change @@ -34,16 +34,13 @@ export const getPreferredPathFormatFromUri = (uri: vscode.Uri): string => {
3434 // check if notebook is open
3535 const notebookUri = vscode . window . activeNotebookEditor ?. notebook . uri ;
3636 if ( useRelativePaths && notebookUri ) {
37- const notebookPath = notebookUri . path ;
38- const contextPath = uri . path ;
39-
4037 // check if both files are on the same drive
4138 // if not, use absolute path
42- const notebookRoot = path . parse ( notebookPath ) . root ;
43- const contextRoot = path . parse ( contextPath ) . root ;
39+ const notebookRoot = path . parse ( notebookUri . fsPath ) . root ;
40+ const contextRoot = path . parse ( uri . fsPath ) . root ;
4441 if ( notebookRoot === contextRoot ) {
4542 // use relative path
46- filePath = path . relative ( path . dirname ( notebookPath ) , contextPath ) ;
43+ filePath = path . relative ( path . dirname ( notebookUri . path ) , uri . path ) ;
4744 }
4845 }
4946 return filePath ;
You can’t perform that action at this time.
0 commit comments