Skip to content
Extraits de code Groupes Projets
Valider cbff449f rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

Put config files in the right place on OS X

parent eeb574b1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -93,6 +93,8 @@ std::string OSX_GetBundleExecutablePath();
/// Pass the basename of the executable to get the path.
std::string OSX_GetBundleAuxillaryExecutablePath(std::string const& executableName);
std::string OSX_GetApplicationSupportDirectory();
/// @brief Open a URI using the Launcher.
/// @param location URI of file
/// @note If this is a FILE or DIRECTORY the path must be ABSOLUTE no 'file://'
......
......@@ -95,6 +95,12 @@ std::string OSX_GetBundleAuxillaryExecutablePath(std::string const& executableNa
}
}
std::string OSX_GetApplicationSupportDirectory() {
@autoreleasepool {
return EmptyIfNil([NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject]);
}
}
void OSX_OpenLocation(std::string const& location) {
@autoreleasepool {
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:location.c_str()]];
......
......@@ -22,6 +22,7 @@
#include <pwd.h>
namespace {
#ifndef __APPLE__
std::string home_dir() {
const char *env = getenv("HOME");
if (env) return env;
......@@ -33,24 +34,23 @@ std::string home_dir() {
throw agi::EnvironmentError("Could not get home directory. Make sure HOME is set.");
}
std::string data_dir() {
#ifndef __APPLE__
return P_DATA;
#else
return agi::util::OSX_GetBundleSharedSupportDirectory();
#endif
}
}
namespace agi {
void Path::FillPlatformSpecificPaths() {
#ifndef __APPLE__
agi::fs::path home = home_dir();
SetToken("?user", home/".aegisub");
SetToken("?local", home/".aegisub");
SetToken("?data", data_dir());
SetToken("?data", P_DATA);
#else
agi::fs::path app_support = agi::util::OSX_GetApplicationSupportDirectory();
SetToken("?user", app_support/"Aegisub");
SetToken("?local", app_support/"Aegisub");
SetToken("?data", agi::util::OSX_GetBundleSharedSupportDirectory());
#endif
SetToken("?temp", boost::filesystem::temp_directory_path());
SetToken("?dictionary", "/usr/share/hunspell");
SetToken("?docs", P_DOC);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter