static void checkWinObjCSDK() { const BuildSettings bs(NULL); String sdkRoot = bs.getValue("WINOBJC_SDK_ROOT"); sbValidateWithTelemetry(!sb_realpath(sdkRoot).empty(), "The WINOBJC_SDK_ROOT directory does not exist: \"" + platformPath(sdkRoot) + "\""); String templateDir = bs.getValue("VSIMPORTER_TEMPLATES_DIR"); sbValidateWithTelemetry(!sb_realpath(templateDir).empty(), "The WINOBJC_SDK_ROOT directory is missing vsimporter templates: \"" + platformPath(sdkRoot) + "\""); }
static void checkWinObjCSDK() { const BuildSettings bs(NULL); String sdkRoot = bs.getValue("WINOBJC_SDK_ROOT"); String baseErrMsg = "Invalid WINOBJC_SDK_ROOT specified: \"" + platformPath(sdkRoot) + "\". "; sbValidate(!sb_realpath(sdkRoot).empty(), baseErrMsg + "The SDK directory does not exist."); String templateDir = bs.getValue("VSIMPORTER_TEMPLATES_DIR"); sbValidate(!sb_realpath(templateDir).empty(), baseErrMsg + "The SDK directory is missing vsimporter templates."); }
XCScheme* XCScheme::createFromFile(const String& schemePath, const PBXProject* owner) { // Check that the owner is valid if (!owner) { return NULL; } // Get absolute path to the scheme file String absSchemePath = sb_realpath(schemePath); if (absSchemePath.empty()) { SBLog::warning() << "The \"" << schemePath << "\" scheme file does not exist." << std::endl; return NULL; } // Read the scheme file pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(schemePath.c_str()); if (!result) { SBLog::warning() << "Failed to parse \"" << schemePath << "\" scheme file." << std::endl; return NULL; } // Create a XCScheme and initialize it XCScheme* ret = new XCScheme(absSchemePath, owner); if (!ret->initFromXML(doc)) { delete ret; ret = NULL; } return ret; }
SBProject* SBWorkspace::openProject(const String& projectPath) { // Get absolute path to the project String absProjPath = sb_realpath(projectPath); // Check that the path is valid if (absProjPath.empty()) { SBLog::warning() << "Invalid project path: " << projectPath << std::endl; return NULL; } // Check if the project has already been opened SBProject* ret = s_workspace->findOpenProject(absProjPath); if (ret) return ret; // Create the project because it doesn't exist yet ret = SBProject::createFromPath(absProjPath); // Save a pointer to the newly create project and find all of its schemes if (ret) { m_openProjects[absProjPath] = ret; findSchemes(absProjPath); } return ret; }
void SBFrameworksBuildPhase::loadFrameworkBlockListFromFile(const String& fileName) { // Get the path to the file which has the block list. const BuildSettings bs(NULL); String templateDir = bs.getValue("VSIMPORTER_TEMPLATES_DIR"); // If we have reached this far the folder is guaranteed to exist as we must have already called checkWinObjCSDK(). assert(!sb_realpath(templateDir).empty()); String blockListFilePath = joinPaths(templateDir, fileName); ifstream file(blockListFilePath); if (file.is_open()) { String line; while (getline(file, line)) { StringVec tokens; tokenize(line, tokens, "-> "); if (tokens.size() == 0) { // empty line continue; } // We do not expect more than 2 tokens per line. // First is the blocked library name and possibly a second token which is the replacement library name. sbValidate(tokens.size() <= 2, "Invalid Block List: Only one blocked library and an optional replacement library separated by '->' are allowed per line"); String blockedLibrary = tokens[0]; // We may or may not have the replacement library specified. String replaceWithLibrary = ""; if (tokens.size() > 1) { replaceWithLibrary = tokens[1]; // Check if the library replacements form a cycle. auto it = s_blockedLibraries.find(replaceWithLibrary); while (it != s_blockedLibraries.end()) { replaceWithLibrary = it->second; sbValidate(blockedLibrary != replaceWithLibrary, blockedLibrary + " is trying to cyclically replace itself with another blocked library."); it = s_blockedLibraries.find(replaceWithLibrary); } } s_blockedLibraries.insert(pair<String, String>(blockedLibrary, replaceWithLibrary)); } file.close(); } }