fix(sql-library): skip restricted folders during import

This commit is contained in:
t8y2 committed 2026-08-02 09:33:02 +08:00
1 parent 329e6d20e3
commit 9b05158c9a
3 files changed
+48 -14

No files matched your search

@@ -206,21 +206,9 @@ async function exportFolderContents(folder?: SavedSqlFolder) {
}
async function collectSqlFilesRecursively(dir: string): Promise<string[]> {
const { readDir } = await import("@tauri-apps/plugin-fs");
const { join } = await import("@tauri-apps/api/path");
const collectPaths = (entries: Awaited<ReturnType<typeof api.listSqlFilesInFolder>>): string[] => entries.flatMap((entry) => (entry.is_dir ? collectPaths(entry.children) : [entry.path]));
const results: string[] = [];
for (const entry of await readDir(dir)) {
const fullPath = await join(dir, entry.name);
if (entry.isDirectory) {
results.push(...(await collectSqlFilesRecursively(fullPath)));
continue;
}
if (!entry.isFile) continue;
if (!fullPath.toLowerCase().endsWith(".sql")) continue;
results.push(fullPath);
}
return results;
return collectPaths(await api.listSqlFilesInFolder(dir));
}
async function importDirectoryIntoLibrary(targetFolder?: SavedSqlFolder) {