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

Calls to Path.GetFileName* are liable to fail on Linux #156

Open
cmbasnett opened this issue Mar 5, 2020 · 1 comment
Open

Calls to Path.GetFileName* are liable to fail on Linux #156

cmbasnett opened this issue Mar 5, 2020 · 1 comment
Labels
bug Something isn't working LINUX

Comments

@cmbasnett
Copy link
Contributor

The C# function Path.GetFileName and Path.GetFileNameWithoutExtension work with native platform directory separators (\ on Windows, / on Linux). This creates problems on Linux, since the game's internal data uses Windows-style paths.

For example:

var path = "C:\\ff8\\Data\\eng\\FIELD\\model\\main_chr\\d000.mch"
var fileName = Path.GetFileNameWithoutExtension(path);
Console.WriteLine(fileName);

// Windows
>> "d000"

// Linux
>> "C:\\ff8\\Data\\eng\\FIELD\\model\\main_chr\\d000"

I will explore a solution on my fork and make a PR.

Let me know if you have any preference as to how to deal with this.

@Sebanisu
Copy link
Collaborator

Sebanisu commented Mar 5, 2020

https://source.dot.net/#System.Private.CoreLib/PathInternal.Unix.cs,cffe6f0bdd450298 seems to confirm what you're saying

Maki has a method to force path names to have correct slash. Maybe could use that to prep the data. It's in the extended.cs

Like where we read the strings in we could change all the slashes to correct ones.

Maybe we can overload utf8 encoding to swap the slashes as it's reading the strings.

@MaKiPL MaKiPL added bug Something isn't working LINUX labels Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LINUX
Projects
None yet
Development

No branches or pull requests

3 participants