obs-outputs: Fix path normalization logic#13206
obs-outputs: Fix path normalization logic#13206grimfoss wants to merge 2 commits intoobsproject:masterfrom
Conversation
|
Background if there are issues: I'm a CS student who's only taken some intro classes so far, I ran into this issue and tracked down the cause pretty quickly and wanted to try my hand at fixing it. I'm not incredibly familiar with git but I believe I followed everything to a tee. Never contributed to anything before so any feedback on any part of this would be greatly appreciated! |
bba57aa to
10b8036
Compare
|
Updated my commit message to match standards |
|
On macOS and POSIX-like platforms, |
I updated it so the original logic is restored, and the new logic is only applied to windows builds. Not sure if this is the preferred method to handle platform differences though. |
Updated path normalization logic to only be applied to windows builds to prevent unintended behavior on mac and posix systems.
79acc56 to
8f30bcf
Compare
|
Considering OBS seems to always normalize directories to use forward slashes internally, and this logic is repeated in mp4-output and obs-ffmpeg-mux, and possibly other places - is a possibly better solution to add a platform specific utiity to libobs to handle directory normalization across the whole program? |
Description
Changed order of operations in generate_filename() in both mp4-output.c and obs-ffmpeg-mux.c so that the full file path gets normalized to use forward slashes, instead of just the directory.
Motivation and Context
In the event that the user provides a formatting string with windows-style directories (%MM\%DD\%hh-%mm-%ss), encoding would either fail to open a new file or crash entirely if the file would be split after the date changes, due to the logic for making a new directory during file splitting only looking for the last forward slash.
How Has This Been Tested?
To test, I set automatic file splitting to 1 minute, and made the formatting string "%ss\%mm" so every split was guaranteed to make a new directory. Running a recording for one minute in each format no longer resulted in a crash or failure at the split, and a new directory being created was successfully observed in each test.
Testing environment:
Windows 11 Home 10.0.26200
AMD Ryzen 9 7900x Processor
Nvidia RTX 5070 Gpu
32GB GDDR5 Memory
Testing was done manually, and I do not expect these changes to affect any other areas.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Tweak (non-breaking change to improve existing functionality)
Checklist: