From f6f75d1e4a527dbcb7ed10f0a9b940ff0163cd2e Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Sat, 5 Mar 2016 12:38:25 +0300 Subject: [PATCH] Use correct path separator when dealing with FRAMEWORK_SEARCH_PATHS --- lib/pbxFile.js | 5 ++--- lib/pbxProject.js | 2 +- test/dataModelDocument.js | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pbxFile.js b/lib/pbxFile.js index b226550..ed6a56d 100644 --- a/lib/pbxFile.js +++ b/lib/pbxFile.js @@ -166,13 +166,12 @@ function pbxFile(filepath, opt) { // for custom frameworks if (opt.customFramework == true) { this.customFramework = true; - this.dirname = path.dirname(filepath); + this.dirname = path.dirname(filepath).replace(/\\/g, '/'); } - this.path = defaultPath(this, filepath); + this.path = defaultPath(this, filepath).replace(/\\/g, '/'); this.fileEncoding = this.defaultEncoding = opt.defaultEncoding || defaultEncoding(self); - // When referencing products / build output files if (opt.explicitFileType) { this.explicitFileType = opt.explicitFileType; diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 77b4530..da05245 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -304,7 +304,7 @@ pbxProject.prototype.removeFramework = function(fpath, opt) { this.removeFromPbxEmbedFrameworksBuildPhase(file); // PBXCopyFilesBuildPhase if (opt && opt.customFramework) { - this.removeFromFrameworkSearchPaths(path.dirname(fpath)); + this.removeFromFrameworkSearchPaths(file.dirname); } return file; diff --git a/test/dataModelDocument.js b/test/dataModelDocument.js index 00a1ac8..fa0b8a8 100644 --- a/test/dataModelDocument.js +++ b/test/dataModelDocument.js @@ -152,7 +152,8 @@ exports.dataModelDocument = { test.equal(xcVersionGroupEntry.children[0], newFile.models[0].fileRef); test.equal(xcVersionGroupEntry.currentVersion, newFile.currentModel.fileRef); test.equal(xcVersionGroupEntry.name, path.basename(singleDataModelFilePath)); - test.equal(xcVersionGroupEntry.path, singleDataModelFilePath); + // Need to validate against normalized path, since paths should contain forward slash on OSX + test.equal(xcVersionGroupEntry.path, singleDataModelFilePath.replace(/\\/g, '/')); test.equal(xcVersionGroupEntry.sourceTree, '""'); test.equal(xcVersionGroupEntry.versionGroupType, 'wrapper.xcdatamodel');