添加 素材库路径检查 处理

This commit is contained in:
Chen committed 2025-12-05 14:27:31 +08:00
1 parent 204180b754
commit fd8dae1823
11 files changed
+1108 -49

No files matched your search

+8 -2
View File
@@ -149,13 +149,19 @@ function addLibrary(name, libraryPath) {
/**
* Remove library from config
* @param {string} libraryId - 要删除的素材库ID
* @param {boolean} autoSelectNext - 是否自动选择下一个素材库,默认 true
*/
function removeLibrary(libraryId) {
function removeLibrary(libraryId, autoSelectNext = true) {
const config = loadConfig();
config.libraries = config.libraries.filter(lib => lib.id !== libraryId);
if (config.currentLibraryId === libraryId) {
config.currentLibraryId = config.libraries.length > 0 ? config.libraries[0].id : null;
if (autoSelectNext) {
config.currentLibraryId = config.libraries.length > 0 ? config.libraries[0].id : null;
} else {
config.currentLibraryId = null;
}
}
saveConfig(config);