We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2173 - SDL_GetPrefPath ignores organization parameter on Linux (patch)
Summary: SDL_GetPrefPath ignores organization parameter on Linux (patch)
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-22 20:48 UTC by Gerry JJ
Modified: 2013-10-24 04:01 UTC (History)
0 users

See Also:


Attachments
Patch: Make SDL_GetPrefPath use an organization dir on Linux (1.05 KB, patch)
2013-10-22 20:48 UTC, Gerry JJ
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerry JJ 2013-10-22 20:48:59 UTC
Created attachment 1392 [details]
Patch: Make SDL_GetPrefPath use an organization dir on Linux

SDL_GetPrefPath ignores the organization parameter on Linux. I don't think it should. This is important to fix now, before anyone uses the function in their games (don't want their save location to suddenly change from underneath them).

There's no standard for what's the right thing to do on Linux. Some games use an org dir in ~/.local/share, others don't (it's about a 50/50 split on my system). There's some advantages of using the org dir though:

* Less chance of name collisions. Without a org dir, your game's name has to be unique among all other games and applications (and potentially orgs) on all platforms that don't use an organization dir, and even system dirs like 'mime' (as unlikely as that is =)). Collisions already happen; as I said on the mailing list, there's at least two open source games called Enigma, for example. Then add all common Linux programs to names you have to avoid, past and future.

* Consistency between platforms. Someone coming from Windows wouldn't even expect this problem to exist when porting the game. Path of least surprise, etc. (er. pun not intended =))

* There's no established standard, so using the organization dir in Linux isn't wrong, and it solves some potential problems. No reason not to do it =)

I've attached a fix.
Comment 1 Gerry JJ 2013-10-22 21:52:28 UTC
I think this should be fixed for the other platforms that don't use org too btw (Mac and BeOS), while it can still be fixed. I'm not familiar enough with those to know if not using org is standard behavior there, though.
Comment 2 Ryan C. Gordon 2013-10-23 05:04:57 UTC
This uses the organization string as of https://hg.libsdl.org/SDL/rev/62f562a475e1

--ryan.
Comment 3 Gerry JJ 2013-10-23 19:21:40 UTC
Great, thank you =)

You forgot to add SDL_strlen(org) to the cocoa code, though.
Comment 4 Ryan C. Gordon 2013-10-24 04:01:49 UTC
(In reply to Gerry JJ from comment #3)
> You forgot to add SDL_strlen(org) to the cocoa code, though.

Good catch! Fixed here: 

     https://hg.libsdl.org/SDL/rev/b34f5e226458

--ryan.