Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Apr 24, 2024

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
Copy link
Member Author

Ghabry commented Apr 24, 2024

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

Otherwise requires UTF-16 conversion and Windows doesn't need this search anyway.
@lumiscosity
Copy link
Contributor

lumiscosity commented Apr 24, 2024

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
Copy link
Member Author

Ghabry commented May 3, 2024

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants