expect(cfg.getFileResources('android').every(hasTargetPropertyDefined)).toBeTruthy();
expect(cfg.getFileResources('windows').every(hasArchPropertyDefined)).toBeTruthy();
});
+
+ it('should find resources at the top level', function() {
+ expect(cfg.getFileResources('android', true).length).toBe(3);
+ });
});
});
});
<icon src="res/windows/logo-small.scale-400_48.png" height="48" target="logo.png"/>
<resource-file src="windowsconfig.json" target="windowsconfig.json" arch="x86" device-target="all" />
</platform>
+ <resource-file src="top-level-file.txt" target="toplevel.txt" />
<plugin name="org.apache.cordova.pluginwithvars">
<variable name="var" value="varvalue" />
</plugin>
/**
* Returns all resource-files for a specific platform.
* @param {string} platform Platform name
+ * @param {boolean} includeGlobal Whether to return resource-files at the
+ * root level.
* @return {Resource[]} Array of resource file objects.
*/
- getFileResources: function(platform) {
+ getFileResources: function(platform, includeGlobal) {
var fileResources = [];
if (platform) { // platform specific resources
});
}
+ if (includeGlobal) {
+ this.doc.findall('resource-file').forEach(function(tag) {
+ fileResources.push({
+ platform: platform || null,
+ src: tag.attrib.src,
+ target: tag.attrib.target,
+ versions: tag.attrib.versions,
+ deviceTarget: tag.attrib['device-target'],
+ arch: tag.attrib.arch
+ });
+ });
+ }
+
return fileResources;
},