refactor: migrate TempDirectoryManager to use vault.adapter exclusively

- Updated TempDirectoryManager to use vault.adapter methods exclusively
- Made all temp directory operations async (ensureTempDir, cleanupTempDir, cleanupAllTempDirs)
- Removed unnecessary fs fallback since App instance is always available in Obsidian plugins
- Updated calling code in PandocTypstConverter and ExportOrchestrator to handle async
- Updated PluginLifecycle cleanup methods to use fire-and-forget async pattern
- All path operations now use normalizePath for cross-platform compatibility
- Simplified interface - App parameter is now required as it should be

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jarvis committed 2025-09-25 12:01:47 +02:00
1 parent 5598e0e538
commit 180155b4e0
4 files changed
+62 -55

No files matched your search

+4 -4
View File
@@ -140,8 +140,8 @@ export class ExportOrchestrator {
try {
// Create temp directory for conversion
const tempManager = new TempDirectoryManager({ vaultPath: vaultPath, configDir: this.plugin.app.vault.configDir });
const tempDir = tempManager.ensureTempDir('pandoc');
const tempManager = new TempDirectoryManager({ vaultPath: vaultPath, configDir: this.plugin.app.vault.configDir, app: this.plugin.app });
const tempDir = await tempManager.ensureTempDir('pandoc');
// Load file content
const content = await this.plugin.app.vault.read(file);
@@ -245,8 +245,8 @@ export class ExportOrchestrator {
// Clean up temporary directories
try {
const cleanupManager = TempDirectoryManager.create(vaultPath, this.plugin.app.vault.configDir);
cleanupManager.cleanupAllTempDirs();
const cleanupManager = TempDirectoryManager.create(vaultPath, this.plugin.app.vault.configDir, undefined, this.plugin.app);
await cleanupManager.cleanupAllTempDirs();
} catch (cleanupError) {
console.warn('Export: Failed to clean up temporary directories:', cleanupError);
}