ask to unmount before exit

This commit is contained in:
FTCHD
2025-02-02 11:34:20 +02:00
parent 8301cff14c
commit a9d9230974
+13 -1
View File
@@ -4,7 +4,7 @@ import { debug, error, info, trace, warn } from '@tauri-apps/plugin-log'
import { exit } from '@tauri-apps/plugin-process' import { exit } from '@tauri-apps/plugin-process'
import type { Command } from '@tauri-apps/plugin-shell' import type { Command } from '@tauri-apps/plugin-shell'
import { validateLicense } from './lib/license' 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 { initRclone } from './lib/rclone/init'
import { usePersistedStore, useStore } from './lib/store' import { usePersistedStore, useStore } from './lib/store'
import { initLoadingTray, initTray, rebuildTrayMenu } from './lib/tray' import { initLoadingTray, initTray, rebuildTrayMenu } from './lib/tray'
@@ -154,6 +154,18 @@ async function startRclone() {
getCurrentWindow().listen('close-app', async (e) => { getCurrentWindow().listen('close-app', async (e) => {
console.log('(main) window close-app requested') 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() await childProcess.kill()
}) })