From a9d9230974806568e1253374a8f01f9dfe5b2b00 Mon Sep 17 00:00:00 2001 From: FTCHD Date: Sun, 2 Feb 2025 11:34:20 +0200 Subject: [PATCH] ask to unmount before exit --- main.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.ts b/main.ts index e1964b7..e572c77 100644 --- a/main.ts +++ b/main.ts @@ -4,7 +4,7 @@ import { debug, error, info, trace, warn } from '@tauri-apps/plugin-log' import { exit } from '@tauri-apps/plugin-process' import type { Command } from '@tauri-apps/plugin-shell' import { validateLicense } from './lib/license' -import { listRemotes } from './lib/rclone/api' +import { listRemotes, unmountAllRemotes } from './lib/rclone/api' import { initRclone } from './lib/rclone/init' import { usePersistedStore, useStore } from './lib/store' import { initLoadingTray, initTray, rebuildTrayMenu } from './lib/tray' @@ -154,6 +154,18 @@ async function startRclone() { getCurrentWindow().listen('close-app', async (e) => { console.log('(main) window close-app requested') + if (rclone.system) { + const answer = await ask('Unmount all remotes before exiting?', { + title: 'Exit', + kind: 'info', + okLabel: 'Unmount', + cancelLabel: 'Exit', + }) + if (answer) { + await unmountAllRemotes() + } + } + await childProcess.kill() })