News for hackers. Stuff that matters.
Re:Dotfile madness by ChrisSD on Saturday February 02, 2019 @06:34PM (#19066596)
As noted below there's a special folder called "Saved Games" that's specifically meant for this purpose. A lot of games still don't use it.
Re:Dotfile madness by user5994461 on Saturday February 02, 2019 @07:48PM (#19066980)
To be fair it's widely used now, it just took a while to adopt because of compatibility issues.

Finding the directory requires new APIs introduced in Vista and Server 2008. See SHGetKnownFolderPath

Re:Dotfile madness by ChrisSD on Saturday February 02, 2019 @08:51PM (#19067261)
Sure but in the non-game software world we'd do a runtime check to see if the OS was Vista or later and fallback if not.
Re:Dotfile madness by user5994461 on Sunday February 03, 2019 @10:31AM (#19070075)
You can't do it as a runtime check. You have to compile the software with the flags to import and link to the latest windows library. The program will hard crash if run on an older version.

I just tried to use the API. I literally couldn't find a working example on the internet in 2 hours so I guess noone figured it out in a decade.

Wrote https://stackoverflow.com/a/54499257/5994461

Re:Dotfile madness by ChrisSD on Sunday February 03, 2019 @04:39PM (#19072402)
What's wrong with calling IsWindowsVistaOrGreater[0]?

[0] https://docs.microsoft.com/en-us/windows/desktop/api/version...

Re:Dotfile madness by user5994461 on Sunday February 03, 2019 @05:15PM (#19072586)
You won't have the chance to call anything. If the executable is statistically linked to the latest API, the executable won't be able to load on older systems.

I'm surprised that these new IsWindows...() functions claim compatibility down to Windows 2000. Doubt microsoft knew how they would name their next release 20 years ago. A Google search indicates that they are in fact broken.

Re:Dotfile madness by ChrisSD on Sunday February 03, 2019 @06:58PM (#19073003)
You won't be able to compile with the function imported using the modern lib (because it doesn't exist on XP) but you can conditionally link it at runtime with LoadLibrary/GetProcAddress.

If IsWindows... doesn't work then you can use the VerifyVersionInfo function directly.

Re:Dotfile madness by h1d on Saturday February 02, 2019 @11:28PM (#19067848)
Why did they have to narrow it down to games? Could just go with "Saved config (and data)", so other apps could just dump small config files which can be effectively backed up.
Re:Dotfile madness by runxel on Saturday February 02, 2019 @07:09PM (#19066791)
And here I am, still wanting my save files to reside next to the games exe...
Re:Dotfile madness by ChrisSD on Saturday February 02, 2019 @07:43PM (#19066955)
Fair enough but on multi-user systems you can surely see the value in separate save game folders?
Re:Dotfile madness by chii on Saturday February 02, 2019 @09:34PM (#19067443)
when was the last time a gaming machine is a multi-user system?!
Re:Dotfile madness by h1d on Saturday February 02, 2019 @11:30PM (#19067855)
Since when every person in a house has their own gaming PC?
Re:Dotfile madness by ChrisSD on Saturday February 02, 2019 @09:51PM (#19067505)
I'm currently typing this on a machine that's used for gaming by more than one person.
Re:Dotfile madness by AnIdiotOnTheNet on Sunday February 03, 2019 @11:44AM (#19070570)
There's no reason there couldn't be separate per-user folders within the game's installation path for that.
Re:Dotfile madness by not_kurt_godel on Saturday February 02, 2019 @11:17PM (#19067806)
Do you also store your birth certificate in your car's glovebox?
Re:Dotfile madness by runxel on Sunday February 03, 2019 @05:05PM (#19072524)
What a misleading comparison...

I don't even get what you want to say.

Re:Dotfile madness by not_kurt_godel on Sunday February 03, 2019 @08:34PM (#19073337)
A game's exe dir is a long-lived but potentially replaceable thing, like a car. Saved games may be persisted across game versions, so you don't necessarily want them to be in the same directory. Admittedly not the best analogy, but was just observing that it's strange and incongruent to store the 2 together.