Updates data paths on OS X and Windows. On OS X only write to locations inside ~/Library. On Windows make the distinction between local and roaming appdata, and use folder inside My Documents for user-created data. Fixes #1145.

Adds proper OS X app bundle support.
Updates Windows installer script.

This was SVN commit r11389.
This commit is contained in:
historic_bruno
2012-03-22 00:23:31 +00:00
parent 1095782d1a
commit 0fda0019d1
12 changed files with 535 additions and 69 deletions
+20 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2012 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -25,6 +25,10 @@
#include "ps/CLogger.h"
#include "ps/GameSetup/Config.h"
#if OS_MACOSX
# include "lib/sysdep/os/osx/osx_bundle.h"
#endif
static void* const HANDLE_UNAVAILABLE = (void*)-1;
// directory to search for libraries (optionally set by --libdir at build-time,
@@ -70,8 +74,23 @@ static CStr extensions[] = {
static CStr GenerateFilename(const CStr& name, const CStr& suffix, const CStr& extension)
{
CStr n;
if (!g_Libdir.empty())
n = g_Libdir + "/";
#if OS_MACOSX
// On OS X, we might be in a bundle in which case the lib directory is ../Frameworks
// relative to the binary, so we use a helper function to get the system path
if (osx_IsAppBundleValid())
{
CStr frameworksPath = osx_GetBundleFrameworksPath();
if (!frameworksPath.empty())
{
n = frameworksPath + "/";
}
}
#endif
n += prefix + name + suffix + extension;
return n;
}