fix(foundry): copy playlists before deleting the unpacked archive

Archive import removed the temp folder before playlist tracks were read, so zip imports with music failed. The dialog hint now names .zip / .fvtt instead of .world.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-10-10 21:05:55 +08:00
parent 877fbaa8e7
commit 5c0c72892d
4 changed files with 40 additions and 21 deletions
+7 -1
View File
@@ -108,6 +108,7 @@ import {
buildProjectFromFoundryDocuments,
loadFoundryDocumentsForImport,
type FoundryImportProgress,
type FoundryPendingAppPlaylist,
} from '../foundry/foundryImport';
import { getAppSemanticVersion } from '../versionInfo';
@@ -2129,7 +2130,8 @@ export class ZipProjectStore {
async importProjectFromFoundry(
sourcePath: string,
onProgress?: (p: FoundryImportProgress) => void,
): Promise<{ project: Project; pendingAppPlaylists: import('../foundry/foundryImport').FoundryPendingAppPlaylist[] }> {
importPlaylists?: (lists: FoundryPendingAppPlaylist[]) => Promise<void>,
): Promise<{ project: Project; pendingAppPlaylists: FoundryPendingAppPlaylist[] }> {
await this.ensureRoots();
const loaded = await loadFoundryDocumentsForImport(sourcePath, onProgress);
try {
@@ -2159,6 +2161,10 @@ export class ZipProjectStore {
await this.writeCacheProject(cacheDir, project);
onProgress?.({ stage: 'zip', percent: 90, detail: 'Сборка проекта…' });
await this.enqueuePack(cacheDir, zipPath);
// Архив распакован во временную папку. Плейлисты читают её по absPath — копировать до cleanup.
if (importPlaylists && pendingAppPlaylists.length > 0) {
await importPlaylists(pendingAppPlaylists);
}
onProgress?.({ stage: 'done', percent: 100, detail: 'Готово' });
return { project: this.openProject.project, pendingAppPlaylists };
} finally {