mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c0130337e | |||
| 4a7aeec869 | |||
| 4f3b03f881 | |||
| 26ed7e3c58 | |||
| 853eb1a5eb | |||
| 283b4ed6af |
@@ -30,25 +30,28 @@ async function showSaveDialog(defaultName, format) {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
} else if (platform === 'win32') {
|
} else if (platform === 'win32') {
|
||||||
// Windows
|
const safeName = decodeURIComponent(defaultName);
|
||||||
const powershell = `
|
|
||||||
Add-Type -AssemblyName System.Windows.Forms
|
|
||||||
$dialog = New-Object System.Windows.Forms.SaveFileDialog
|
|
||||||
$dialog.FileName = "${defaultName}.${format}"
|
|
||||||
$dialog.Filter = "${format.toUpperCase()} Dateien (*.${format})|*.${format}|Alle Dateien (*.*)|*.*"
|
|
||||||
$dialog.Title = "Dokument speichern als"
|
|
||||||
$result = $dialog.ShowDialog()
|
|
||||||
if ($result -eq 'OK') { $dialog.FileName }
|
|
||||||
`;
|
|
||||||
|
|
||||||
try {
|
const powershell = `
|
||||||
const result = execSync(`powershell -Command "${powershell.replace(/\n/g, '; ')}"`, {
|
Add-Type -AssemblyName System.Windows.Forms;
|
||||||
encoding: 'utf8'
|
$dialog = New-Object System.Windows.Forms.SaveFileDialog;
|
||||||
});
|
$dialog.FileName = '${safeName}.${format}';
|
||||||
return result.trim() || null;
|
$dialog.Filter = '${format.toUpperCase()} Dateien (*.${format})|*.${format}|Alle Dateien (*.*)|*.*';
|
||||||
} catch (err) {
|
$dialog.Title = 'Dokument speichern als';
|
||||||
throw err;
|
$result = $dialog.ShowDialog();
|
||||||
}
|
if ($result -eq 'OK') { $dialog.FileName }
|
||||||
|
`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = execSync(
|
||||||
|
`powershell -NoProfile -Command "${powershell.replace(/\r?\n/g, ' ')}"`,
|
||||||
|
{ encoding: 'utf8' }
|
||||||
|
);
|
||||||
|
return result.trim() || null;
|
||||||
|
} catch (err) {
|
||||||
|
if (err.status === 1) return null; // User cancelled
|
||||||
|
throw new Error("Save dialog failed: " + err.message);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Linux - zenity oder kdialog
|
// Linux - zenity oder kdialog
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user