Skip to content
Permalink
Browse files
CB-14099 osx: Fixed Resolve Config Path for OSX
 This closes #32
  • Loading branch information
erisu authored and tripodsan committed Jun 27, 2018
1 parent c104401 commit 7bf9627f0135c6b3518292660b6e07e6f5815926
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
@@ -72,6 +72,12 @@ describe('ConfigFile tests', function () {
expect(configFile.resolveConfigFilePath('project_dir', 'ios', 'config.xml')).toBe(configPath);
});

it('resolveConfigFilePath should return file path', function () {
spyOn(configFile, 'getIOSProjectname').and.returnValue('osxpath');
var configPath = path.join('project_dir', 'osxpath', 'config.xml');
expect(configFile.resolveConfigFilePath('project_dir', 'osx', 'config.xml')).toBe(configPath);
});

it('resolveConfigFilePath should return file path', function () {
var configPath = path.join('project_dir', 'config.xml');
expect(configFile.resolveConfigFilePath('project_dir', 'ubuntu', 'config.xml')).toBe(configPath);
@@ -211,9 +211,12 @@ function resolveConfigFilePath (project_dir, platform, file) {
if (file === 'config.xml') {
if (platform === 'ubuntu') {
filepath = path.join(project_dir, 'config.xml');
} else if (platform === 'ios') {
var iospath = module.exports.getIOSProjectname(project_dir);
filepath = path.join(project_dir, iospath, 'config.xml');
} else if (platform === 'ios' || platform === 'osx') {
filepath = path.join(
project_dir,
module.exports.getIOSProjectname(project_dir),
'config.xml'
);
} else {
matches = modules.glob.sync(path.join(project_dir, '**', 'config.xml'));
if (matches.length) filepath = matches[0];
@@ -225,7 +228,7 @@ function resolveConfigFilePath (project_dir, platform, file) {
return filepath;
}

// Find out the real name of an iOS project
// Find out the real name of an iOS or OSX project
// TODO: glob is slow, need a better way or caching, or avoid using more than once.
function getIOSProjectname (project_dir) {
var matches = modules.glob.sync(path.join(project_dir, '*.xcodeproj'));

0 comments on commit 7bf9627

Please sign in to comment.