This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-common.git
The following commit(s) were added to refs/heads/master by this push:
new 3a0afd3 fix(ConfigFile): correctly resolve *-Info.plist file path
(#124)
3a0afd3 is described below
commit 3a0afd3902fff344d479de1022633253ab8bbce1
Author: Arman <[email protected]>
AuthorDate: Sun Mar 15 08:46:15 2020 +0300
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 <[email protected]>
---
spec/ConfigChanges/ConfigFile.spec.js | 15 +++++++++++++++
src/ConfigChanges/ConfigFile.js | 3 ++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/spec/ConfigChanges/ConfigFile.spec.js
b/spec/ConfigChanges/ConfigFile.spec.js
index ad35c19..e47f7e0 100644
--- a/spec/ConfigChanges/ConfigFile.spec.js
+++ b/spec/ConfigChanges/ConfigFile.spec.js
@@ -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);
+ });
});
});
});
diff --git a/src/ConfigChanges/ConfigFile.js b/src/ConfigChanges/ConfigFile.js
index 6b476d6..4e83119 100644
--- a/src/ConfigChanges/ConfigFile.js
+++ b/src/ConfigChanges/ConfigFile.js
@@ -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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]