Tools icon indicating copy to clipboard operation
Tools copied to clipboard

lmu2png: Make search of Chipset in lmu2png case-insensitive

Open Ghabry opened this issue 10 months ago • 3 comments

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 avatar Apr 24 '24 09:04 Ghabry

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

Ghabry avatar Apr 24 '24 09:04 Ghabry

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...

lumiscosity avatar Apr 24 '24 18:04 lumiscosity

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>

Ghabry avatar May 03 '24 14:05 Ghabry