From c6a5e1f34625105286be9ccc12b015f5034605f2 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Thu, 25 Sep 2025 12:09:17 +0200 Subject: [PATCH] refactor: migrate ExportOrchestrator to use PathUtils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replaced unsafe basePath hack with PathUtils.getVaultPath() - Replaced path.join with PathUtils.joinPath() and getPluginDir() - Removed unused path import after migration - Added PathUtils integration for consistent path operations - TempDirectoryManager calls already updated in previous commit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/plugin/ExportOrchestrator.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugin/ExportOrchestrator.ts b/src/plugin/ExportOrchestrator.ts index ab0f77a..6c733b5 100644 --- a/src/plugin/ExportOrchestrator.ts +++ b/src/plugin/ExportOrchestrator.ts @@ -11,10 +11,14 @@ import { ModalSettingsHelper } from '../core/ModalSettingsHelper'; import { MarkdownPreprocessor } from '../converters/MarkdownPreprocessor'; import { TempDirectoryManager } from '../core/TempDirectoryManager'; import { ExportErrorHandler } from '../core/ExportErrorHandler'; -import * as path from 'path'; +import { PathUtils } from '../core/PathUtils'; export class ExportOrchestrator { - constructor(private plugin: obsidianTypstPDFExport) {} + private readonly pathUtils: PathUtils; + + constructor(private plugin: obsidianTypstPDFExport) { + this.pathUtils = new PathUtils(plugin.app); + } /** * Export a file with default configuration @@ -132,8 +136,8 @@ export class ExportOrchestrator { * Export a file with specific configuration */ async exportFileWithConfig(file: TFile, config: ExportConfig): Promise { - const vaultPath = (this.plugin.app.vault.adapter as unknown as { basePath: string }).basePath; - const pluginDir = path.join(vaultPath, this.plugin.manifest.dir!); + const vaultPath = this.pathUtils.getVaultPath(); + const pluginDir = this.pathUtils.joinPath(vaultPath, this.pathUtils.getPluginDir(this.plugin.manifest)); // Create controller for this export (allows cancellation) this.plugin.currentExportController = new AbortController();