From 05a998f77725403564ee4e2efeee512d9d402019 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 2 Feb 2010 23:21:19 +0000 Subject: [PATCH] Code cleanup to improve readability. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4995 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 29 ++++-------- Source/Core/Common/Src/CommonPaths.h | 70 +++++++++++++++------------- 2 files changed, 46 insertions(+), 53 deletions(-) diff --git a/SConstruct b/SConstruct index d8e8768540..d9f6c229d6 100644 --- a/SConstruct +++ b/SConstruct @@ -242,37 +242,24 @@ if flavour == 'debug': elif flavour == 'prof': extra = '-prof' -# TODO: support global install +# Set up the install locations if (ARGUMENTS.get('install') == 'global'): env['prefix'] = os.path.join(env['prefix'] + os.sep) -else: - env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + extra +os.sep) -#TODO add lib -if (ARGUMENTS.get('install') == 'global'): - env['plugin_dir'] = env['prefix'] + 'lib/dolphin-emu/' -else: - if sys.platform == 'darwin': - env['plugin_dir'] = env['prefix'] + 'Dolphin.app/Contents/PlugIns/' - else: - env['plugin_dir'] = env['prefix'] + 'Plugins/' -#TODO add bin -if (ARGUMENTS.get('install') == 'global'): env['binary_dir'] = env['prefix'] + 'bin/' -else: - env['binary_dir'] = env['prefix'] -#TODO add bin -if (ARGUMENTS.get('install') == 'global'): env['libs_dir'] = env['prefix'] + 'lib/' -else: - env['libs_dir'] = env['prefix'] + 'Libs/' -#TODO where should this go? -if (ARGUMENTS.get('install') == 'global'): + env['plugin_dir'] = env['prefix'] + 'lib/dolphin-emu/' env['data_dir'] = env['prefix'] + "share/dolphin-emu/" else: + env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + extra + os.sep) + env['binary_dir'] = env['prefix'] if sys.platform == 'darwin': + env['plugin_dir'] = env['prefix'] + 'Dolphin.app/Contents/PlugIns/' env['data_dir'] = env['prefix'] + 'Dolphin.app/Contents/' + env['libs_dir'] = env['prefix'] + 'Libs/' else: + env['plugin_dir'] = env['prefix'] + 'plugins/' env['data_dir'] = env['prefix'] + env['libs_dir'] = env['prefix'] + 'lib/' env['RPATH'].append(env['libs_dir']) diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 36ad84fad2..56adffbfa9 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -24,14 +24,14 @@ // Library suffix/prefix #ifdef _WIN32 -#define PLUGIN_PREFIX "" -#define PLUGIN_SUFFIX ".dll" + #define PLUGIN_PREFIX "" + #define PLUGIN_SUFFIX ".dll" #elif defined __APPLE__ -#define PLUGIN_PREFIX "lib" -#define PLUGIN_SUFFIX ".dylib" -#else -#define PLUGIN_PREFIX "lib" -#define PLUGIN_SUFFIX ".so" + #define PLUGIN_PREFIX "lib" + #define PLUGIN_SUFFIX ".dylib" +#elif defined __linux__ + #define PLUGIN_PREFIX "lib" + #define PLUGIN_SUFFIX ".so" #endif // Directory seperators, do we need this? @@ -39,42 +39,48 @@ #define DIR_SEP_CHR '/' // Location of the plugins -#ifdef LIBS_DIR -#define PLUGINS_DIR LIBS_DIR "dolphin-emu" +#ifdef _WIN32 + #define PLUGINS_DIR "Plugins" #elif defined __APPLE__ -#define PLUGINS_DIR "Contents/PlugIns" -#else -#define PLUGINS_DIR "Plugins" + #define PLUGINS_DIR "Contents/PlugIns" +#elif defined __linux__ + #ifdef LIBS_DIR + #define PLUGINS_DIR LIBS_DIR "dolphin-emu" + #else + #define PLUGINS_DIR "plugins" + #endif #endif // The user data dir #define ROOT_DIR "." -#ifdef __linux__ -#define USERDATA_DIR "user" -#else -#define USERDATA_DIR "User" -#endif -#ifdef USER_DIR -#define DOLPHIN_DATA_DIR USER_DIR -#elif defined _WIN32 -#define DOLPHIN_DATA_DIR "Dolphin" +#ifdef _WIN32 + #define USERDATA_DIR "User" + #define DOLPHIN_DATA_DIR "Dolphin" #elif defined __APPLE__ -#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin" -#else -#define DOLPHIN_DATA_DIR ".dolphin" + #define USERDATA_DIR "User" + #define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin" +#elif defined __linux__ + #define USERDATA_DIR "user" + #ifdef USER_DIR + #define DOLPHIN_DATA_DIR USER_DIR + #else + #define DOLPHIN_DATA_DIR ".dolphin" + #endif #endif // Shared data dirs (Sys and shared User for linux) -#ifdef DATA_DIR -#define SYSDATA_DIR DATA_DIR "Sys" -#define SHARED_USER_DIR DATA_DIR USERDATA_DIR DIR_SEP +#ifdef _WIN32 + #define SYSDATA_DIR "Sys" #elif defined __APPLE__ -#define SYSDATA_DIR "Contents/Sys" + #define SYSDATA_DIR "Contents/Sys" #elif defined __linux__ -#define SYSDATA_DIR "sys" -#define SHARED_USER_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP -#else -#define SYSDATA_DIR "Sys" + #ifdef DATA_DIR + #define SYSDATA_DIR DATA_DIR "sys" + #define SHARED_USER_DIR DATA_DIR USERDATA_DIR DIR_SEP + #else + #define SYSDATA_DIR "sys" + #define SHARED_USER_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP + #endif #endif // Dirs in both User and Sys