npwoods / bletchmame

Other
29 stars 6 forks source link

Expand environment variables when importing MAME.INI #312

Closed davide125 closed 2 years ago

davide125 commented 2 years ago

MAME INI paths can include environment variables (e.g. $HOME), so ensure they're properly expanded when importing. The implementation of expandEnvironmentVariables is taken from https://stackoverflow.com/a/22507319

npwoods commented 2 years ago

I don't object to this in principle, but I had no idea that MAME supported this. I can't get it to happen on Windows. I'd like to understand how you got MAME to do this on your platform.

davide125 commented 2 years ago

It's implemented in osd_subst_env, e.g. see https://github.com/mamedev/mame/blob/master/src/osd/modules/file/posixdir.cpp#L227

npwoods commented 2 years ago

Thanks for the info! I need to sit down and see how this works on Windows; there seems to be an implementation that calls ExpandEnvironmentStringsW but I can't get MAME to actually honor %HOME%. I need to debug MAME.

https://docs.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-expandenvironmentstringsw

npwoods commented 2 years ago

Merging; I'll follow up with this with a Windows version