mirror of https://github.com/odrling/Aegisub
Put config files in the right place on OS X
This commit is contained in:
parent
eeb574b1f9
commit
cbff449f8f
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue