makehumancommunity / makehuman

This is the main repository for the MakeHuman application as such.
http://www.makehumancommunity.org
Other
1.18k stars 244 forks source link

On Windows, fails silently if registry key-value "...\User Shell Folders\Personal" is missing #203

Closed zmic closed 1 week ago

zmic commented 1 year ago

For whatever reason, "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal" was missing on my system which causes getpath.getHomePath() to throw error.

So double-clicking the desktop icon just did nothing which was very confusing for first-time user me.

The value defaults to "%USERPROFILE%\Documents" so changing getpath.py like this fixed it for me:

        with winreg.OpenKey(winreg.HKEY_CURRENT_USER, keyname) as k:
            try:
                value, type_ = winreg.QueryValueEx(k, 'Personal')
            except FileNotFoundError:
                value, type_ = "%USERPROFILE%\Documents", winreg.REG_EXPAND_SZ
joepal1976 commented 1 year ago

Thanks. Having a fallback seems like an obviously good thing to have. I have added it to master now, so it should appear in the next nightly build.

zmic commented 1 year ago

Now I notice it should be r"%USERPROFILE%\Documents" with the "r" in front to escape the backslash. Maybe you caught that.

rwbaer commented 1 year ago

FWIW, Windows supports the forward slash just fine. It is preferrable to use the forward slash for paths in a cross-platform context to avoid having to include unnecessary escape characters.

luzpaz commented 10 months ago

Is this still relevant ?

Aranuvir commented 1 week ago

@Rob: Since this code part is windows specific, I think it's the better solution using back slashes here. But in that case we need raw strings or have to escape the back slashes. With commit a8bc2d54ff0ac92e78ff71431b1023eda42bf482 its a raw string now. Guess the issue can be closed.