fix: fix batch script Cyrillic paths and disk export backslash stripping on Windows#21245
fix: fix batch script Cyrillic paths and disk export backslash stripping on Windows#21245Mr-Charvaka wants to merge 4 commits into
Conversation
…_images.bat - Redirect sqlite3 output to a temporary file and read it from the file instead of running sqlite3 directly in the for loop. This avoids the cmd.exe character truncation/corruption parser bug when executing commands under UTF-8 code page 65001. - Temporarily change code page to 65001 (UTF-8) during the file existence check loop so non-ASCII characters are interpreted correctly by the OS. - Add quotes around path existence check to properly support paths containing spaces. Fixes darktable-org#20915.
…th on Windows - Replace all backslashes with forward slashes on Windows before variable expansion to prevent backslashes from being stripped as escape characters. - Forward slashes are natively supported as path separators by Windows filesystem APIs, keeping directory structure intact. Fixes darktable-org#20981.
…ort path on Windows - Replace all backslashes with forward slashes on Windows before variable expansion to prevent backslashes from being stripped as escape characters. - Forward slashes are natively supported as path separators by Windows filesystem APIs, keeping directory structure intact. Related to darktable-org#20981.
…path on Windows - Replace all backslashes with forward slashes on Windows before variable expansion to prevent backslashes from being stripped as escape characters. - Forward slashes are natively supported as path separators by Windows filesystem APIs, keeping directory structure intact. Related to darktable-org#20981.
|
@wpferguson : What's your view on those windows issues? |
|
If this PR was generated with AI assistance, please note that. What kind of testing was done? Was it only tested to make sure the problem was fixed or was testing also done to make sure there were no regressions or issues created by the fix? |
@victoryforce would probably be the better one to ask about the Cyrillic issue. I would recommend splitting this PR in 2 since it solves 2 problems that aren't really related except that they are both on Windows. It's easier to test one issue at and time and if necessary roll back one issue at a time. |
|
For the first part of this PR there is an earlier duplicate #20916 |
|
I’ll carefully review the changes, and if any problems surface, I’ll create a new PR after thorough verification and keep you informed. thanks @wpferguson @andriiryzhkov ! |
|
@Mr-Charvaka : It would be much better to split this PR into two separate addressing each issue individually. Especially considering first one is duplicate fix. Not saying it is better or worse though. |
|
@Mr-Charvaka : The
Your codepage save/restore is nicer than #20916's blanket Could you drop the |
This PR resolves two Windows-specific issues:
Fix purge_nonexistent_images.bat with Cyrillic paths (
purge_nonexistent_images.batremoves existing files #20915):sqlite3output to a temp file and reads it usingusebackqinsidefor /f, avoiding the cmd.exe character truncation/corruption parser bug when executing subprocesses under CP 65001.if not exist "%%b"to correctly handle folders/filenames containing spaces.Fix Windows backslash path stripping in disk, gallery, and latex storage modules (Files are exported in a wrong location if using backslashes in the path #20981):
d->filenamein thestore()function on Windows by replacing all backslashes\with forward slashes/before copying to the pattern string.