22* @Author: sxf
33* @Date: 2015-11-08 11:16:04
44* @Last Modified by: sxf
5- * @Last Modified time: 2015-12-20 12:02:27
5+ * @Last Modified time: 2015-12-25 11:16:36
66*/
77
88#include < stdlib.h>
99#include " PathGetter.h"
1010#include " FileUtils.h"
1111#include " PathUtils.h"
12-
12+ # include " elite_tools.h "
1313
1414class PathGetter_Private {
1515public:
@@ -21,6 +21,7 @@ class PathGetter_Private {
2121 string elite_parser_path;
2222 string elite_now_path;
2323 string elite_tools_path;
24+ string elite_packages_path;
2425};
2526
2627
@@ -53,6 +54,11 @@ const char* PathGetter::getEliteToolsPath() {
5354 return getInstance ()->elite_tools_path .c_str ();
5455}
5556
57+ const char * PathGetter::getElitePackagesPath () {
58+ return getInstance ()->elite_packages_path .c_str ();
59+ }
60+
61+
5662PathGetter_Private* PathGetter::getInstance () {
5763 if (instance == NULL ) {
5864 instance = new PathGetter_Private ();
@@ -75,11 +81,14 @@ void PathGetter_Private::setPath() {
7581 elite_lib_path = elite_home;
7682 elite_cfg_path = elite_home;
7783 elite_tools_path = elite_home;
84+ elite_packages_path = elite_home;
7885 elite_lib_path.append (" /libs" );
7986 elite_cfg_path.append (" /conf" );
87+ elite_packages_path.append (" /packages" );
8088 // 本地化
8189 elite_lib_path = PathUtils::native (elite_lib_path);
8290 elite_cfg_path = PathUtils::native (elite_cfg_path);
91+ elite_packages_path = PathUtils::native (elite_packages_path);
8392
8493 if (!FileUtils::test_dir (elite_lib_path)) {
8594 printf (" %s 目录找不到\n " , elite_lib_path.c_str ());
@@ -89,16 +98,12 @@ void PathGetter_Private::setPath() {
8998 printf (" %s 目录找不到\n " , elite_cfg_path.c_str ());
9099 exit (1 );
91100 }
101+ if (!FileUtils::test_dir (elite_packages_path)) {
102+ printf (" %s 目录找不到\n " , elite_packages_path.c_str ());
103+ exit (1 );
104+ }
92105
93- #if defined(_WIN32)
94- elite_tools_path.append (" /tools/windows_x64" );
95- #endif
96- #if defined(__linux__)
97- elite_tools_path.append (" /tools/linux_x64" );
98- #endif
99- #if defined(__APPLE__) && defined(__MACH__)
100- elite_tools_path.append (" /tools/darwin_x64" );
101- #endif
106+ elite_tools_path.append (ELITE_TOOLS_PATH);
102107 // 本地化
103108 elite_tools_path = PathUtils::native (elite_tools_path);
104109
0 commit comments