EasyRPG / Tools

Assorted tools to handle RPG Maker 2000/2003 files
https://easyrpg.org/tools/
49 stars 18 forks source link

lmu2png: Make search of Chipset in lmu2png case-insensitive #85

Open Ghabry opened 2 months ago

Ghabry commented 2 months ago

While testing the other PR I was annoyed that the test game cannot be converted because basis.png is lowercase. ^^

Using std::filesystem, our tools are only executed on recent systems. So should be fine for our needs.

Ghabry commented 2 months ago

lol so much about "should be fine". Build fails on Windows :sweat_smile: ...

lumiscosity commented 2 months ago

i've been testing some filepath stuff on windows and return std::filesystem::exists(filename); is a better alternative to the current windows code, as it actually works with special characters in the filepath (at least japanese characters)

EDIT: this seems to only work when building under msys2 mingw...

Ghabry commented 2 months ago

Okay I finally checked this now on Windows:

The fs::path constructor accepts std::string but it is in the legacy codepage.

What fails to compile is std::string name_lc = entry.path().filename(); because this returns a wchar_t on Windows. To get a std::string one can use std::string name_lc = entry.path().filename().u8string(); at least until C++17. Afterwards it fails because this function is deprecated (they invented std::u8string in C++20).


So I can use most of the fs-API without frustration. It is just the conversion back to strings that is an issue.


Now about fs::exists(fpath). When I hardcode it to fs::exists("主人公1.png") it fails for me.

It starts working when adding this Manifest here:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <application>
    <windowsSettings>
      <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
    </windowsSettings>
  </application>
</assembly>