Skip to content
Permalink
Browse files
fix(ConfigFile): correctly resolve *-Info.plist file path (#124)
* fix(ConfigParser): correctly resolve *-Info.plist file path
* test(ConfigFile): test Info.plist file resolve

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
  • Loading branch information
Armanio and raphinesse committed Mar 15, 2020
1 parent 406e1a2 commit 3a0afd3902fff344d479de1022633253ab8bbce1
Showing 2 changed files with 17 additions and 1 deletion.
@@ -101,6 +101,21 @@ describe('ConfigFile tests', function () {
var configPath = path.join('project_dir', 'app', 'src', 'main', file, 'xml');
expect(ConfigFile.resolveConfigFilePath('project_dir', 'android', file)).toBe(configPath);
});

it('should return *-Info.plist file', function () {
const projName = 'XXX';
const expectedPlistPath = `${projName}-Info.plist`;

ConfigFile.__set__('getIOSProjectname', () => projName);
spyOn(require('glob'), 'sync').and.returnValue([
`AAA/${projName}-Info.plist`,
`Pods/Target Support Files/Pods-${projName}/Info.plist`,
`Pods/Target Support Files/Pods-${projName}/Pods-${projName}-Info.plist`,
expectedPlistPath
]);

expect(ConfigFile.resolveConfigFilePath('', 'ios', '*-Info.plist')).toBe(expectedPlistPath);
});
});
});
});
@@ -175,7 +175,8 @@ function resolveConfigFilePath (project_dir, platform, file) {
// [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
if (matches.length > 1 && file.includes('-Info.plist')) {
const plistName = `${getIOSProjectname(project_dir)}-Info.plist`;
filepath = matches.find(m => m.includes(plistName)) || filepath;
const plistPath = path.join(project_dir, plistName);
if (matches.includes(plistPath)) return plistPath;
}
return filepath;
}

0 comments on commit 3a0afd3

Please sign in to comment.