| 966 | } |
| 967 | |
| 968 | bool Properties::getPath(const char* name, std::string* path) const |
| 969 | { |
| 970 | AXASSERT(name && path, "Invalid name or path"); |
| 971 | const char* valueString = getString(name); |
| 972 | if (valueString) |
| 973 | { |
| 974 | if (FileUtils::getInstance()->isFileExist(valueString)) |
| 975 | { |
| 976 | path->assign(valueString); |
| 977 | return true; |
| 978 | } |
| 979 | else |
| 980 | { |
| 981 | const Properties* prop = this; |
| 982 | while (prop != NULL) |
| 983 | { |
| 984 | // Search for the file path relative to the bundle file |
| 985 | const std::string* dirPath = prop->_dirPath; |
| 986 | if (dirPath != NULL && !dirPath->empty()) |
| 987 | { |
| 988 | std::string relativePath = *dirPath; |
| 989 | relativePath.append(valueString); |
| 990 | if (FileUtils::getInstance()->isFileExist(relativePath)) |
| 991 | { |
| 992 | path->assign(relativePath); |
| 993 | return true; |
| 994 | } |
| 995 | } |
| 996 | prop = prop->_parent; |
| 997 | } |
| 998 | } |
| 999 | } |
| 1000 | return false; |
| 1001 | } |
| 1002 | |
| 1003 | const char* Properties::getVariable(const char* name, const char* defaultValue) const |
| 1004 | { |