The swiss army knife of lossless video/audio editing
Treat control characters as invalid in Windows file names
Claudeea1dccba087e
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex e383cd36..99ede8c3 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -113,7 +113,8 @@ If you have an issue with the Snap or Flatpak version of LosslessCut, please try- Try [removing the AppContainer restrictions](https://github.com/mifi/lossless-cut/discussions/2043#discussioncomment-14909957) on LosslessCut.- Disable your anti-virus or whitelist LosslessCut. See [#18](https://github.com/mifi/lossless-cut/issues/18), [#1114](https://github.com/mifi/lossless-cut/issues/1114).- Video preview playback slow, stuttering, low FPS, flickering (NVIDIA)- - See [#922](https://github.com/mifi/lossless-cut/issues/922) [#1904](https://github.com/mifi/lossless-cut/issues/1904) [#1915](https://github.com/mifi/lossless-cut/issues/1915) [#922](https://github.com/mifi/lossless-cut/issues/922) [#2083](https://github.com/mifi/lossless-cut/issues/2083) [#2556](https://github.com/mifi/lossless-cut/issues/2556)+ - Try to turn off *Max Frame Rate* and *Background Application Max Frame Rate* in NVIDIA Control Panel → Manage 3D settings (either globally, or just for LosslessCut under Program Settings).+ - See [#922](https://github.com/mifi/lossless-cut/issues/922) [#1904](https://github.com/mifi/lossless-cut/issues/1904) [#1915](https://github.com/mifi/lossless-cut/issues/1915) [#2083](https://github.com/mifi/lossless-cut/issues/2083) [#2556](https://github.com/mifi/lossless-cut/issues/2556)- Why no `.exe`/`.zip`/`.appx` downloads?- I decided to stop distributing exe/zip and instead just [7zip](https://github.com/mifi/lossless-cut/releases/latest/download/LosslessCut-win-x64.7z), due to the [problems](https://github.com/mifi/lossless-cut/issues/1072#issuecomment-1066026323) that the (self-extracting) exe was causing and the large size of `.zip` files. `appx` is unsigned and [**does not work**](https://github.com/mifi/lossless-cut/issues/337).- I'm getting a `KERNEL32.dll` errordiff --git a/src/renderer/src/util/outputNameTemplate.ts b/src/renderer/src/util/outputNameTemplate.tsindex 6e78a529..02fc0e02 100644--- a/src/renderer/src/util/outputNameTemplate.ts+++ b/src/renderer/src/util/outputNameTemplate.ts@@ -51,6 +51,9 @@ export interface GenerateMergedOutFileNamesParams {epochMs: number;}+// make invisible control characters readable, e.g. U+0009+const formatInvalidChar = (char: string) => (char < ' ' ? `U+${char.codePointAt(0)!.toString(16).toUpperCase().padStart(4, '0')}` : char);+function getTemplateProblems({ fileNames, filePath, outputDir, safeOutputFileName }: {fileNames: string[],filePath: string,@@ -73,6 +76,8 @@ function getTemplateProblems({ fileNames, filePath, outputDir, safeOutputFileNam// note that we allow path separators in some cases (see below)if (isWindows) {['<', '>', ':', '"', '|', '?', '*'].forEach((char) => invalidChars.add(char));+ // control characters https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions+ for (let code = 0; code < 32; code += 1) invalidChars.add(String.fromCodePoint(code));} else if (isMac) {// Colon is invalid on windows https://github.com/mifi/lossless-cut/issues/631 and on MacOS, but not Linux https://github.com/mifi/lossless-cut/issues/830[':'].forEach((char) => invalidChars.add(char));@@ -105,7 +110,7 @@ function getTemplateProblems({ fileNames, filePath, outputDir, safeOutputFileNam}const matchingInvalidChars = new Set([...fileName].filter((char) => invalidChars.has(char)));if (matchingInvalidChars.size > 0) {- error = i18n.t('At least one resulting file name contains invalid character(s): {{invalidChars}}', { invalidChars: `"${[...matchingInvalidChars].join('", "')}"` });+ error = i18n.t('At least one resulting file name contains invalid character(s): {{invalidChars}}', { invalidChars: `"${[...matchingInvalidChars].map((char) => formatInvalidChar(char)).join('", "')}"` });break;}if (sameAsInputPath) {