Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Feb 15, 2018
1 parent 32952ca commit 54b264e
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions scripts/lib/iosWKWebViewEngineSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,37 @@ function loadProjectFile_cordova_5_and_6() {
}

function loadProjectFile_cordova_7_and_above() {
var pbxPath = path.join(iosPlatformPath, projectName + '.xcodeproj', 'project.pbxproj');
var xcodeproj = context.requireCordovaModule('xcode').project(pbxPath);
xcodeproj.parseSync();

var saveProj = function() {
fs.writeFileSync(pbxPath, xcodeproj.writeSync());
};

return {
xcode: xcodeproj,
write: saveProj
};
var project_files = context.requireCordovaModule('glob').sync(path.join(iosPlatformPath(), '*.xcodeproj', 'project.pbxproj'));

if (project_files.length === 0) {
throw new Error('does not appear to be an xcode project (no xcode project file)');
}

var pbxPath = project_files[0];

var xcodeproj = context.requireCordovaModule('xcode').project(pbxPath);
xcodeproj.parseSync();

return {
'xcode': xcodeproj,
write: function () {
var fs = context.requireCordovaModule('fs');

var frameworks_file = path.join(iosPlatformPath(), 'frameworks.json');
var frameworks = {};
try {
frameworks = context.requireCordovaModule(frameworks_file);
} catch (e) { }

fs.writeFileSync(pbxPath, xcodeproj.writeSync());
if (Object.keys(frameworks).length === 0){
// If there is no framework references remain in the project, just remove this file
context.requireCordovaModule('shelljs').rm('-rf', frameworks_file);
return;
}
fs.writeFileSync(frameworks_file, JSON.stringify(this.frameworks, null, 4));
}
};
}

/**
Expand Down

0 comments on commit 54b264e

Please sign in to comment.