fix: Windows uyumlulugu - APPDATA config, taskkill
Some checks failed
Build Windows / build-windows (push) Has been cancelled

This commit is contained in:
Alhan
2026-07-22 06:00:39 +03:00
parent d622d0ec04
commit 9a0e89bcea
5 changed files with 12 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -5,8 +5,13 @@ import 'package:flutter/material.dart';
/// Persists and restores window position and size. /// Persists and restores window position and size.
class WindowPersistence { class WindowPersistence {
static File get _configFile { static File get _configFile {
final home = Platform.environment['HOME'] ?? '/tmp'; String dir;
return File('$home/.config/imajviewer/window.json'); if (Platform.isWindows) {
dir = '${Platform.environment['APPDATA'] ?? Platform.environment['USERPROFILE'] ?? '.'}/imajviewer';
} else {
dir = '${Platform.environment['HOME'] ?? '/tmp'}/.config/imajviewer';
}
return File('$dir/window.json');
} }
/// Save window rect synchronously (safe to call before destroy). /// Save window rect synchronously (safe to call before destroy).

View File

@@ -21,7 +21,11 @@ class AppShortcuts extends StatelessWidget {
// Ctrl+Shift+Q: tüm pencereleri kapat // Ctrl+Shift+Q: tüm pencereleri kapat
if (ctrl && shift && event.logicalKey == LogicalKeyboardKey.keyQ) { if (ctrl && shift && event.logicalKey == LogicalKeyboardKey.keyQ) {
Process.runSync('pkill', ['imajviewer']); if (Platform.isWindows) {
Process.runSync('taskkill', ['/F', '/IM', 'imajviewer.exe']);
} else {
Process.runSync('pkill', ['imajviewer']);
}
return KeyEventResult.handled; return KeyEventResult.handled;
} }

Binary file not shown.