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

Lua scripts are not loaded if there are non-Latin characters in the username #7701

Closed
PalmtopTiger opened this issue May 8, 2020 · 7 comments
Labels

Comments

@PalmtopTiger
Copy link

PalmtopTiger commented May 8, 2020

The problem occurs when there are non-Latin characters in AppData path.
Also, some lua scripts cannot save files to %AppData%\mpv folder even with portable_config. Works.

Important Information

Reproduction steps

  • Create a folder with non-Latin characters. For example: C:\mpv\Настройки.
  • Put some scripts in C:\mpv\Настройки\scripts folder.
  • Open the console.
  • Set MPV_HOME variable: set MPV_HOME=C:\mpv\Настройки.
  • Launch mpv.

Expected behavior

Scripts loaded

Actual behavior

Lua error: cannot open C:\Users\Андрей\AppData\Roaming\mpv/scripts/autoload.lua: No such file or directory

Log file

output.txt

@ghost
Copy link

ghost commented May 8, 2020

Yes, that's because we let Lua open the file. Windows is an absolutely braindead piece of shit, so you need extra hacks to even open a file that has non-ASCII parts in its name or path, and Lua didn't implement these hacks.

@PalmtopTiger
Copy link
Author

Is it possible to fix this?

AppData seems to work fine in Lua with portable_config. My mistake.

I found a workaround - setting MPV_HOME to a DOS path, for example: C:\Users\A4F7~1\AppData\Roaming\mpv.

@ghost
Copy link

ghost commented May 8, 2020

Probably trivial to fix, someone just has to do it.

@ghost
Copy link

ghost commented May 8, 2020

PS: and at least half the cursing goes to MinGW and their shitmess too, because they force EVERYONE to reimplement wrappers for open/fopen and any other standard C functions which take filenames.

@zc62
Copy link
Contributor

zc62 commented May 8, 2020

#4903 #6424 and might be even more.

@ghost ghost closed this as completed in c258478 May 10, 2020
@ghost
Copy link

ghost commented May 10, 2020

This particular issue is probably solved now, but Lua filesystem functions in general are not affected by this change.

ghost pushed a commit that referenced this issue May 10, 2020
Bill Gates did not only create COVID, he's also responsible for the
world's worst OS, where you have to literally jump through hoops of fire
to open files with Unicode file names. Lua did not care to implement any
jumping, so it's our turn to jump.

Untested (on win32).

Fixes: #7701
@PalmtopTiger
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants