- Changed unix config directory from ~/.zdoom to ~/.config/zdoom to comply with Ubuntu Software Centre guidelines.

SVN r3797 (trunk)
This commit is contained in:
Braden Obrzut 2012-07-30 09:31:04 +00:00
parent 0aee56be15
commit 67f64081d0
3 changed files with 36 additions and 4 deletions

View File

@ -340,9 +340,41 @@ FString GetUserFile (const char *file)
struct stat info;
path = NicePath("~/" GAME_DIR "/");
if (stat (path, &info) == -1)
{
if (mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
struct stat extrainfo;
// Sanity check for ~/.config
FString configPath = NicePath("~/.config/");
if (stat (configPath, &extrainfo) == -1)
{
if (mkdir (configPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
{
I_FatalError ("Failed to create ~/.config directory:\n%s", strerror(errno));
}
}
else if (!S_ISDIR(extrainfo.st_mode))
{
I_FatalError ("~/.config must be a directory");
}
// This can be removed after a release or two
// Transfer the old zdoom directory to the new location
bool moved = false;
FString oldpath = NicePath("~/.zdoom/");
if (stat (oldpath, &extrainfo) != -1)
{
if (rename(oldpath, path) == -1)
{
I_Error ("Failed to move old zdoom directory (%s) to new location (%s).",
oldpath.GetChars(), path.GetChars());
}
else
moved = true;
}
if (!moved && mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
{
I_FatalError ("Failed to create %s directory:\n%s",
path.GetChars(), strerror (errno));
@ -682,7 +714,7 @@ void M_ScreenShot (const char *filename)
if (dirlen == 0)
{
#ifdef unix
autoname = "~/.zdoom/screenshots/";
autoname = "~/" GAME_DIR "/screenshots/";
#elif defined(__APPLE__)
char cpath[PATH_MAX];
FSRef folder;

View File

@ -1088,7 +1088,7 @@ static FString GetCachePath()
path += "/zdoom/cache";
#else
// Don't use GAME_DIR and such so that ZDoom and its child ports can share the node cache.
path = NicePath("~/.zdoom/cache");
path = NicePath("~/.config/zdoom/cache");
#endif
return path;
}

View File

@ -116,7 +116,7 @@ static inline const char *MakeSaveSig()
#define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3"
#ifdef unix
#define GAME_DIR ".zdoom"
#define GAME_DIR ".config/zdoom"
#elif defined(__APPLE__)
#define GAME_DIR GAMENAME
#else