Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 2479636

Browse files
committed
refactor(setLibrary): remove old library paths
1 parent 97c495a commit 2479636

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/setLibrary.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'node:path';
2-
import { storagePath } from './extension';
2+
import { storagePath, id as extensionId } from './extension';
33
import getLuaConfig from './getLuaConfig';
44
import getSettingsScope from './getSettingsScope';
55

@@ -9,6 +9,15 @@ export default async function setLibrary(folders: string[], enable: boolean) {
99

1010
for (const folder of folders) {
1111
const folderPath = path.join(storagePath, 'library', folder);
12+
13+
for (let i = library.length - 1; i >= 0; i--) {
14+
const el = library[i];
15+
16+
if (el.includes(extensionId) && !el.includes('globalStorage')) {
17+
library.splice(i, 1);
18+
}
19+
}
20+
1221
const index = library.indexOf(folderPath);
1322

1423
if (enable) {

0 commit comments

Comments
 (0)