Skip to content

Commit 308adfa

Browse files
committed
Add VES bundled fallback paths
1 parent bd6254d commit 308adfa

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

server/src/parser.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const asyncExec = util.promisify(exec);
1212
let isBusy = false;
1313
const doxyfilePath = path.join(__dirname, "..", "..", "..", "resources", "Doxyfile");
1414

15+
const vesBundledCorePath = path.join(__dirname, "..", "..", "..", "..", "..", "..", "vuengine", "core");
16+
const vesBundledPluginsPath = path.join(__dirname, "..", "..", "..", "..", "..", "..", "vuengine", "plugins");
17+
1518
const tempBasePath = path.join(os.tmpdir(), "virtual-c-ls");
1619
if (!fs.existsSync(tempBasePath)) {
1720
fs.mkdirSync(tempBasePath);
@@ -23,22 +26,19 @@ const getWorkspaceFolders = async (): Promise<WorkspaceFolder[]> => {
2326
return [];
2427
}
2528

26-
await Promise.all(
27-
[
28-
'build.engine.core.path',
29-
'plugins.library.path',
30-
'plugins.user.path',
31-
]
32-
.map(async (setting) => {
33-
const configuredPath = await connection.workspace.getConfiguration(setting);
34-
if (configuredPath) {
35-
workspaceFolders.push({
36-
'uri': `file://${configuredPath}`,
37-
'name': path.basename(configuredPath),
38-
});
39-
}
40-
})
41-
);
29+
await Promise.all([
30+
['build.engine.core.path', vesBundledCorePath],
31+
['plugins.library.path', vesBundledPluginsPath],
32+
['plugins.user.path'],
33+
].map(async (setting) => {
34+
const configuredPath = (await connection.workspace.getConfiguration(setting[0])) ?? setting[1];
35+
if (configuredPath && fs.existsSync(configuredPath)) {
36+
workspaceFolders.push({
37+
'uri': `file://${configuredPath}`,
38+
'name': path.basename(configuredPath),
39+
});
40+
}
41+
}));
4242

4343
return workspaceFolders
4444
.filter((obj, index, self) =>
@@ -65,7 +65,8 @@ export const parseWorkspace = async () => {
6565
export const getDoxygenData = async (folders: string[]): Promise<Record<string, { classes: object, structs: object }>> => {
6666
const result: Record<string, { classes: object, structs: object }> = {};
6767
await Promise.all(folders.map(async folder => {
68-
const tempPath = path.join(tempBasePath, Buffer.from(folder).toString('base64'));
68+
const folderBase64 = Buffer.from(folder).toString('base64');
69+
const tempPath = path.join(tempBasePath, folderBase64);
6970
if (fs.existsSync(tempPath)) {
7071
fs.rmSync(tempPath, { recursive: true, force: true });
7172
}
@@ -93,7 +94,7 @@ export const getDoxygenData = async (folders: string[]): Promise<Record<string,
9394

9495
const doxygenPath = await getDoxygenPath();
9596

96-
const tempDoxyfilePath = path.join(tempBasePath, 'Doxyfile');
97+
const tempDoxyfilePath = path.join(tempBasePath, `Doxyfile-${folderBase64}`);
9798
if (fs.existsSync(doxyfilePath)) {
9899
const doxyfileContent = [
99100
fs.readFileSync(doxyfilePath).toString(),

0 commit comments

Comments
 (0)