[
https://issues.apache.org/jira/browse/CB-13614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16272717#comment-16272717
]
George Campbell edited comment on CB-13614 at 11/30/17 2:23 PM:
----------------------------------------------------------------
I don't have permission to push up a branch for a pull request, but this is my
proposed solution (a one line addition).
{{/bin/template/cordova/browser_handler.js}}
starting at line 115
{noformat}
asset: {
install: function (asset, plugin_dir, wwwDest) {
var src = path.join(plugin_dir, asset.src);
var dest = path.join(wwwDest, asset.target);
if (fs.statSync(src).isDirectory()) {
shell.cp('-Rf', src + '/*', dest);
} else {
// Add this mkdir command to create the directory path if it
does not already exist.
shell.mkdir(path.parse(dest).dir);
shell.cp('-f', src, dest);
}
},
uninstall: function (asset, wwwDest, plugin_id) {
shell.rm('-rf', path.join(wwwDest, asset.target));
shell.rm('-rf', path.join(wwwDest, 'plugins', plugin_id));
}
}
};
{noformat}
was (Author: geocolumbus):
I don't have permission to push up a branch for a pull request, but this is my
proposed solution:
{{/bin/template/cordova/browser_handler.js}}
starting at line 115
{noformat}
asset: {
install: function (asset, plugin_dir, wwwDest) {
var src = path.join(plugin_dir, asset.src);
var dest = path.join(wwwDest, asset.target);
if (fs.statSync(src).isDirectory()) {
shell.cp('-Rf', src + '/*', dest);
} else {
// Only change is to add this line to create the directory path
if it does not already exist
shell.mkdir(path.parse(dest).dir);
shell.cp('-f', src, dest);
}
},
uninstall: function (asset, wwwDest, plugin_id) {
shell.rm('-rf', path.join(wwwDest, asset.target));
shell.rm('-rf', path.join(wwwDest, 'plugins', plugin_id));
}
}
};
{noformat}
> Asset tag create only works if file is targeted to root directory
> -----------------------------------------------------------------
>
> Key: CB-13614
> URL: https://issues.apache.org/jira/browse/CB-13614
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-browser
> Affects Versions: 5.0.1
> Reporter: George Campbell
> Assignee: Jesse MacFadyen
>
> Inside a plugin.xml file,
> <asset src="www/style/inappbrowser.css" target="style/inappbrowser.css"/>
> results in:
> cp: copyFileSync: could not write to dest file
> (code=ENOENT):/Users/campbelg/IdeaProjects/wms-circ-app/platforms/browser/platform_www/style/inappbrowser.css
> Related to CB-13562, which fixed the case of an asset file whose target was
> the root directory. This bug is for assets whose target contains a directory.
> The expected behavior is described by the plugin.xml documentation:
> https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#asset
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]