Enhances path handling and file resolution #5

Merged
AlexKucera merged 36 commits from 1.3.0 into master 2025-09-25 16:47:12 +02:00
Showing only changes of commit e084ff38cb - Show all commits
+12 -2
View File
1
@@ -35,8 +35,18 @@ export class TemplateManager {
return ['default.typ'];
}
// Read directory contents
const list = await this.plugin.app.vault.adapter.list(this.templatesPath);
// Read directory contents - convert absolute path to vault-relative
const vaultBasePath = this.pathUtils.getVaultPath();
let vaultRelativePath = this.templatesPath;
// Convert absolute path to vault-relative path
if (this.templatesPath.startsWith(vaultBasePath)) {
vaultRelativePath = this.templatesPath.substring(vaultBasePath.length);
// Remove leading separators
vaultRelativePath = vaultRelativePath.replace(/^[/\\]+/, '');
}
const list = await this.plugin.app.vault.adapter.list(vaultRelativePath);
const files = list.files.map(filePath => path.basename(filePath));
// Filter for .typ and .pandoc.typ files