@@ -47,7 +47,7 @@ export class Manager {
47
47
48
48
const docURI = vscode . window . activeTextEditor ! . document . uri ;
49
49
const configuration = vscode . workspace . getConfiguration ( 'PandocCiter' , docURI ) ;
50
- const rootFolder = vscode . workspace . getWorkspaceFolder ( docURI ) . uri . fsPath ;
50
+ const rootFolder = vscode . workspace . getWorkspaceFolder ( docURI ) ? .uri . fsPath ;
51
51
52
52
const activeText = vscode . window . activeTextEditor ! . document . getText ( ) ;
53
53
const yamltext = activeText . match ( / - - - \r ? \n ( ( .+ \r ? \n ) + ) - - - / gm)
@@ -66,7 +66,7 @@ export class Manager {
66
66
const rootfile : string = configuration . get ( 'RootFile' )
67
67
if ( rootfile !== "" ) {
68
68
let curInput = path . join ( rootfile ) ;
69
- if ( ! path . isAbsolute ( curInput ) ) {
69
+ if ( ! path . isAbsolute ( curInput ) && rootFolder ) {
70
70
curInput = path . join ( rootFolder , rootfile ) ;
71
71
}
72
72
const rootText = fs . readFileSync ( curInput , 'utf8' ) ;
@@ -116,8 +116,10 @@ export class Manager {
116
116
resolveBibFile ( bibFile : string , rootFolder : string ) {
117
117
if ( path . isAbsolute ( bibFile ) ) {
118
118
return bibFile ;
119
- } else {
119
+ } else if ( rootFolder ) {
120
120
return path . resolve ( path . join ( rootFolder , bibFile ) ) ;
121
+ } else {
122
+ return path . resolve ( path . dirname ( vscode . window . activeTextEditor ! . document . fileName ) , bibFile )
121
123
}
122
124
}
123
125
0 commit comments