Skip to content

Commit b531c74

Browse files
committed
Fix base directory of glslify
1 parent f94ab07 commit b531c74

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bufferprovider.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,18 @@ void main() {
313313
}
314314

315315
if (this.context.getConfig<boolean>('enableGlslifySupport')) {
316+
let baseDir = path.dirname(rootFile);
317+
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0)
318+
{
319+
baseDir = vscode.workspace.workspaceFolders[0].uri.fsPath;
320+
}
321+
322+
this.showInformationAtLine(file, `Using root path '${baseDir}' for glslify`, 0);
323+
316324
// glslify the code
317325
const glsl = require('glslify'); // eslint-disable-line @typescript-eslint/no-var-requires
318326
try {
319-
code = glsl(code);
327+
code = glsl.compile(code, {basedir: baseDir});
320328
}
321329
catch (e) {
322330
vscode.window.showErrorMessage((e as Error).message);

0 commit comments

Comments
 (0)