Closed cbentejac closed 6 months ago
Check if we can just remove the file exists test.
Yes, the test itself can be removed. OIIO, which correctly handles non-ASCII characters all by itself, will succeed in opening the file if it exists or fail if it doesn't, in which case we will still be able to throw an error.
Description
An image file's existence was checked prior to being passed to OIIO to be loaded, and if the test failed, an error was thrown. This worked fine for Linux platforms but in case a non-ASCII character was part of the image's path on Windows, that test always failed because non-ASCII characters are not correctly handled by default.
OIIO is however able to correctly read existing image files, independently from the type of characters their path contains. If a file with or without non-ASCII characters does not exist, the
ImageBuf
object will not be correctly initialized, and we will be able to catch it and throw an error. If it does exist, it will be correctly read in all cases.There is thus no need for the test on the file's existence anymore.
With this PR, fatal errors that some of the executables were facing on Windows when using images with non-ASCII characters in their path, even though those images were valid and could be read by OIIO without any issue. (fixes https://github.com/alicevision/Meshroom/issues/2139#issuecomment-1850892428)