Skip to content

Commit

Permalink
Updated to catch error for normailized path and simply do root path
Browse files Browse the repository at this point in the history
  • Loading branch information
Mossy1022 committed Jul 8, 2024
1 parent b6800d5 commit eb2a195
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ import { App, TFile, TFolder, normalizePath } from 'obsidian';

export async function saveFile(app: App, audioBlob: Blob, fileName: string, path: string): Promise<TFile> {
try {
const normalizedPath = normalizePath(path);
const filePath = `${normalizedPath}/${fileName}`;

let normalizedPath: string;
try {
normalizedPath = normalizePath(path);
if (!normalizedPath) {
console.warn('Normalized path is invalid, using root path');
normalizedPath = '/'; // Set to root path of the vault
}
} catch (error) {
console.warn('Error normalizing path, using root path:', error);
normalizedPath = '/'; // Set to root path of the vault
} const filePath = `${normalizedPath}/${fileName}`;

await ensureDirectoryExists(app, normalizedPath);

Expand Down
1 change: 1 addition & 0 deletions whisper.cpp
Submodule whisper.cpp added at c11873

0 comments on commit eb2a195

Please sign in to comment.