[ 
https://issues.apache.org/jira/browse/CB-13471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16466323#comment-16466323
 ] 

ASF GitHub Bot commented on CB-13471:
-------------------------------------

dpogue closed pull request #10: CB-13471 : added unit test for config file 
provider
URL: https://github.com/apache/cordova-common/pull/10
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/spec/ConfigChanges/ConfigFile.spec.js 
b/spec/ConfigChanges/ConfigFile.spec.js
index 3724efe..2da5ee8 100644
--- a/spec/ConfigChanges/ConfigFile.spec.js
+++ b/spec/ConfigChanges/ConfigFile.spec.js
@@ -76,4 +76,16 @@ describe('ConfigFile tests', function () {
         var configPath = path.join('project_dir', 'config.xml');
         expect(configFile.resolveConfigFilePath('project_dir', 'ubuntu', 
'config.xml')).toBe(configPath);
     });
+
+    it('resolveConfigFilePath should return file path', function () {
+        var file = path.join('res', 'xml');
+        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);
+    });
 });
diff --git a/src/ConfigChanges/ConfigFile.js b/src/ConfigChanges/ConfigFile.js
index ec4a28a..5934d5c 100644
--- a/src/ConfigChanges/ConfigFile.js
+++ b/src/ConfigChanges/ConfigFile.js
@@ -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));
@@ -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);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Fix compile error with cordova-plugin-camera and file providers
> ---------------------------------------------------------------
>
>                 Key: CB-13471
>                 URL: https://issues.apache.org/jira/browse/CB-13471
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: cordova-android
>            Reporter: Joe Bowser
>            Assignee: Joe Bowser
>            Priority: Blocker
>
> File Providers fails due to an AAPT error: 
> /Users/jbowser/cordova/mobilespec/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:64:35-54:
>  AAPT: No resource found that matches the given name (at 'resource' with 
> value '@xml/provider_paths').
> /Users/jbowser/cordova/mobilespec/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:62:
>  error: Error: No resource found that matches the given name (at 'resource' 
> with value '@xml/provider_paths').



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to