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

Fix crash when savedata directory path contains non-ascii characters #207

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

kartoFlane
Copy link
Member

@kartoFlane kartoFlane commented Apr 16, 2023

Packaged mod loader for testing: ITB-ModLoader-PR207.zip

@Lemonymous
Copy link
Contributor

This sounds like a good PR to get in.
Do you have any tips on how it could be tested? Preferably without having to change my savedata path.

@kartoFlane
Copy link
Member Author

The easiest way would be to simply create a lua file with non-ASCII characters in its path, and then try to load that file with modApi:loadIntoEnv, and verify that it doesn't crash, and that whatever the lua file returned, has been returned by this function.

To test the full case as originally reported, you'd probably need to create a new user on your PC with non-ASCII characters in its name, and run ITB as that user - as far as I understand, this should be enough to get ITB to create a separate savedata directory in that user's home directory.

I think the easier test is enough to verify this, though of course it would be nice to get confirmation with the full case, too.

@Lemonymous
Copy link
Contributor

The following test passed

test.lua

tbl = {
	entry1 = "first entry",
	entry2 = "second entry",
}
+ NON_ASCII = {}
+ modApi:loadIntoEnv("Æsir 神H4x0r çøđèr/test.lua", NON_ASCII)

I tried creating a user with non-ascii characters as well, but ITB decided to simply store the save data in a users folder inside the ITB game directory, so I wasn't able to test any further.

@Lemonymous
Copy link
Contributor

Merging, as it seems to do what it says it does even if I wasn't able to test it specifically with save data for a user name with non-ascii characters.

Thank you!

@Lemonymous Lemonymous merged commit 500e9c1 into master Apr 19, 2023
@Lemonymous Lemonymous deleted the fix/non-ascii-homedir branch April 19, 2023 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants