RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1.03k stars 178 forks source link

Fixed issues with special characters in username under MS Windows. #2857

Closed ohlidalp closed 4 months ago

ohlidalp commented 2 years ago

Under MS Windows, you can't use naked fopen() or std::fstream as they don't accept UTF-8 encoded paths with special characters.

As a solution, we use OGRE file system API exclusively.

Components reviewed in this audit:

tritonas00 commented 2 years ago

Still doesn't load though kk

ohlidalp commented 2 years ago

o.O Well, that can only mean zziplib (which is behind Ogre::ZipArchive) can't do it. Let me see...

... well, no: https://github.com/OGRECave/ogre/blob/master/OgreMain/src/OgreZip.cpp#L106 - the file is opened via _openFileStream() helper which exist specifically to resolve the windows unicode problem. I'm baffled.

tritonas00 commented 2 years ago

o.O Well, that can only mean zziplib (which is behind Ogre::ZipArchive) can't do it. Let me see...

... well, no: https://github.com/OGRECave/ogre/blob/master/OgreMain/src/OgreZip.cpp#L106 - the file is opened via _openFileStream() helper which exist specifically to resolve the windows unicode problem. I'm baffled.

Wrong code though, we use 1.11.6, not latest OGRE master

Here you are https://github.com/OGRECave/ogre/blob/v1.11.6/OgreMain/src/OgreZip.cpp#L182

ohlidalp commented 2 years ago

Wrong code, we use 1.11.6, not latest OGRE master

True, I should really 💤 instead. 😄

Well, I was right, it uses zzip (master uses assimp) https://github.com/OGRECave/ogre/blob/3fc7c8e8e95204894865576d2b45cd4606d6d262/OgreMain/src/OgreZip.cpp#L182

EDIT: Though zziplib has a complex system of custom file handlers: https://github.com/gdraheim/zziplib/blob/8e10dc825ba37b9a1c9faa684370f6271e33ecbc/zzip/zip.c#L834 ... it's possible I missed some override in OGRE.

tritonas00 commented 2 years ago

Well, we need to move to latest ogre then, advanced a bit https://github.com/tritonas00/rigs-of-rods/commits/ogre-13, following your steps

Still bites like a mad dog though :laughing:

tritonas00 commented 2 years ago

Wrong code, we use 1.11.6, not latest OGRE master

True, I should really zzz instead. smile

Well, I was right, it uses zzip (master uses assimp) https://github.com/OGRECave/ogre/blob/3fc7c8e8e95204894865576d2b45cd4606d6d262/OgreMain/src/OgreZip.cpp#L182

EDIT: Though zziplib has a complex system of custom file handlers: https://github.com/gdraheim/zziplib/blob/8e10dc825ba37b9a1c9faa684370f6271e33ecbc/zzip/zip.c#L834 ... it's possible I missed some override in OGRE.

Ogre 13 fixes it, just tried, folders/files created successfully

ohlidalp commented 4 months ago

Closing as obsolete - all signifficant commits from this PR already made it's way to master.