3 ms·
The former does not in fact work everywhere, it only works on Windows. Once you have your #ifdef, there is absolutely no point in having the wrong Windows-speci
by pie_flavor 4y ago
The former does not in fact work everywhere, it only works on Windows. Once you have your #ifdef, there is absolutely no point in having the wrong Windows-specific code instead of the right Windows-specific code. Also, look at what you're describing as weird bullshit: a function call with an enum, instead of a function call with a string. The only difference is that you haven't bothered to familiarize yourself with the world outside of Linux, so it feels unfamiliar.
Also, you're comparing something it makes zero sense to compare. People are not saying 'you need to fetch $USERPROFILE without calling getenv'. People are saying 'you need to not store random garbage in $USERPROFILE'. Calling getenv("APPDATA") is a perfectly fine way of fetching FOLDERID_RoamingAppData, the same way you weren't going to bother calling getpwuid if $HOME was undefined.
- matheusmoreira 4y ago> The former does not in fact work everywhere, it only works on Windows. It's just some example code. Real code will probably try a number of variables. > Calling getenv("APPDATA") is a perfectly fine way of fetching FOLDERID_RoamingAppData Okay then. Top level post said you needed a Win32 function for this. If you can do that without those functions, I suppose it's easy enough to support. > calling getpwuid if $HOME was undefined $HOME is set by login and ssh to whatever is in the passwd database. Can it ever be undefined? Seems like something is seriously wrong if it is.