Change to stl::filesystem from Boost::filesystem

Everything about development and the OpenMW source code.
User avatar
DecumusScotti
Posts: 49
Joined: 08 Jul 2016, 17:26

Re: Change to stl::filesystem from Boost::filesystem

Post by DecumusScotti » 05 Nov 2019, 21:52

I think it wasn't mentioned yet:

There's a bug in mingw (gcc for Windows) which renders std::filesystem unusable right now. I'm currently writing some code that has to be platform-independent, and while C++17 is allowed, I still can't use std::filesystem (or even C++14 with std::experimental/filesystem), because mingw has a bug that prevents it from compiling as soon as you include <filesystem> and do anything with it (e.g. any example from any cpp reference).

So while it would be great to switch, here's just one more reason why it's gotta wait.

User avatar
AnyOldName3
Posts: 1799
Joined: 26 Nov 2015, 03:25

Re: Change to stl::filesystem from Boost::filesystem

Post by AnyOldName3 » 06 Nov 2019, 00:24

Any support in OpenMW for MSYS/MINGW/CGYWIN/WSL is accidental and breaking it isn't a blocker for anything. It's nice to have if we can keep it, but it's not something we go out of our way to target.
AnyOldName3, Master of Shadows

User avatar
psi29a
Posts: 4801
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Change to stl::filesystem from Boost::filesystem

Post by psi29a » 06 Nov 2019, 14:14

According to:
https://sourceforge.net/p/mingw-w64/bugs/737/
https://stackoverflow.com/questions/523 ... windows-10

You should switch to using msys2, then you can use std::filesystem with mingw

User avatar
Greendogo
Posts: 1432
Joined: 26 Aug 2011, 02:04

Re: Change to stl::filesystem from Boost::filesystem

Post by Greendogo » 10 Apr 2020, 06:12

Has this been done yet?

User avatar
psi29a
Posts: 4801
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Change to std::filesystem from Boost::filesystem

Post by psi29a » 10 Apr 2020, 10:26

So long as MacOS on Travis-CI hasn't been bumped to Catalina or higher, we're stuck.
Android SDK also does not support std::filesystem yet.

We can perhaps bump to C++17 and use some of the features, but we the main reason to move is for boost::filesystem...

User avatar
AnyOldName3
Posts: 1799
Joined: 26 Nov 2015, 03:25

Re: Change to stl::filesystem from Boost::filesystem

Post by AnyOldName3 » 10 Apr 2020, 12:59

Have I mentioned how we're using boost::path::operator>> to get data files paths out of openmw.cfg? I doubt an equivalent std version would have the same escape system. We'd maybe have to look into what we'd do to maintain compatibility versus make things less bonkers.
AnyOldName3, Master of Shadows

User avatar
psi29a
Posts: 4801
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Change to stl::filesystem from Boost::filesystem

Post by psi29a » 10 Apr 2020, 13:33

std::filesystem is more or less a 1:1 with boost::filesystem, including the same unicode quirks. I seem to remember that path was okay... but the fstream that was the problem because boost treats them as boost paths while standard library treats them as char *. So we might have to do some hand-holding there.

Post Reply