mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-29 07:05:14 -07:00
refactor: improve path resolution readability
This commit is contained in:
@@ -10,12 +10,12 @@ export const tauriFilesystem: PlatformFilesystem = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
const resolvedPath =
|
let resolvedPath = '';
|
||||||
typeof filePath === 'string'
|
if (typeof filePath === 'string') {
|
||||||
? filePath
|
resolvedPath = filePath;
|
||||||
: filePath && typeof filePath === 'object' && 'path' in filePath
|
} else if (filePath && typeof filePath === 'object' && 'path' in filePath) {
|
||||||
? (filePath as { path: string }).path
|
resolvedPath = (filePath as { path: string }).path;
|
||||||
: '';
|
}
|
||||||
|
|
||||||
if (!resolvedPath) {
|
if (!resolvedPath) {
|
||||||
throw new Error('Failed to resolve save path');
|
throw new Error('Failed to resolve save path');
|
||||||
|
|||||||
Reference in New Issue
Block a user