mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-18 14:20:42 -07:00
Move tauri imports behind platform abstraction, merge CUDA build into release workflow
- Add openPath and pickDirectory to PlatformFilesystem interface - Remove direct @tauri-apps/plugin-shell and plugin-dialog imports from app - Merge build-cuda.yml into release.yml as a parallel job
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { PlatformFilesystem, FileFilter } from '@/platform/types';
|
||||
import type { FileFilter, PlatformFilesystem } from '@/platform/types';
|
||||
|
||||
export const tauriFilesystem: PlatformFilesystem = {
|
||||
async saveFile(filename: string, blob: Blob, filters?: FileFilter[]) {
|
||||
@@ -12,9 +12,8 @@ export const tauriFilesystem: PlatformFilesystem = {
|
||||
|
||||
if (!filePath) return; // User cancelled the dialog
|
||||
|
||||
const resolvedPath = typeof filePath === 'string'
|
||||
? filePath
|
||||
: (filePath as { path: string }).path;
|
||||
const resolvedPath =
|
||||
typeof filePath === 'string' ? filePath : (filePath as { path: string }).path;
|
||||
|
||||
if (!resolvedPath) {
|
||||
throw new Error('Failed to resolve save path from dialog');
|
||||
@@ -23,4 +22,17 @@ export const tauriFilesystem: PlatformFilesystem = {
|
||||
const arrayBuffer = await blob.arrayBuffer();
|
||||
await writeFile(resolvedPath, new Uint8Array(arrayBuffer));
|
||||
},
|
||||
|
||||
async openPath(path: string) {
|
||||
const { open } = await import('@tauri-apps/plugin-shell');
|
||||
await open(path);
|
||||
},
|
||||
|
||||
async pickDirectory(title: string) {
|
||||
const { open } = await import('@tauri-apps/plugin-dialog');
|
||||
const selected = await open({ directory: true, title });
|
||||
if (!selected) return null;
|
||||
const dir = typeof selected === 'string' ? selected : (selected as { path: string }).path;
|
||||
return dir || null;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user