Skip to content

Commit

Permalink
CB-13471: Fix tests and path issues for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
raphinesse authored and dpogue committed May 7, 2018
1 parent f5b1cd2 commit 5bc0764
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spec/ConfigChanges/ConfigFile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@ 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('resolveConfigFilePath should return file path', function () {
var file = 'res/xml';
var configPath = path.join('project_dir', 'app', 'src', 'main', file, 'xml');
expect(configFile.resolveConfigFilePath('project_dir', 'android', file)).toBe(configPath);
});
});
4 changes: 3 additions & 1 deletion src/ConfigChanges/ConfigFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ function resolveConfigFilePath (project_dir, platform, file) {
var filepath = path.join(project_dir, file);
var matches;

file = path.normalize(file);

if (file.indexOf('*') > -1) {
// handle wildcards in targets using glob.
matches = modules.glob.sync(path.join(project_dir, '**', file));
Expand Down Expand Up @@ -195,7 +197,7 @@ function resolveConfigFilePath (project_dir, platform, file) {
} else if (file.endsWith('strings.xml')) {
// Plugins really shouldn't mess with strings.xml, since it's able to be localized
filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'values', 'strings.xml');
} else if (file.match(/res\/xml/)) {
} else if (file.includes(path.join('res', 'xml'))) {
// Catch-all for all other stored XML configuration in legacy plugins
var config_file = path.basename(file);
filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'xml', config_file);
Expand Down

0 comments on commit 5bc0764

Please sign in to comment.