mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-08 02:13:24 +00:00
feat: implement settings engine with directory picker and aria2 configuration sync
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
|
||||
export const useDirectoryPicker = () => {
|
||||
const pickDirectory = async (defaultPath?: string): Promise<string | null> => {
|
||||
try {
|
||||
const selected = await open({
|
||||
directory: true,
|
||||
multiple: false,
|
||||
defaultPath: defaultPath,
|
||||
});
|
||||
if (selected && typeof selected === 'string') {
|
||||
return selected;
|
||||
}
|
||||
return null;
|
||||
} catch (e) {
|
||||
console.error('Failed to pick directory:', e);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return { pickDirectory };
|
||||
};
|
||||
Reference in New Issue
Block a user