You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2017/01/25 15:50:10 UTC

[3/4] cordova-windows git commit: Emit warning if resource-file copy will overwrite target

Emit warning if resource-file copy will overwrite target


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/22bdf679
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/22bdf679
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/22bdf679

Branch: refs/heads/master
Commit: 22bdf67906f9e3527f0baa17ac7e2eb2a8900f7b
Parents: 8f89a1f
Author: ktop <kt...@gmail.com>
Authored: Tue Dec 13 16:51:56 2016 -0500
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Wed Jan 25 18:49:56 2017 +0300

----------------------------------------------------------------------
 template/cordova/lib/PluginHandler.js | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/22bdf679/template/cordova/lib/PluginHandler.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/PluginHandler.js b/template/cordova/lib/PluginHandler.js
index 6150845..2476f02 100644
--- a/template/cordova/lib/PluginHandler.js
+++ b/template/cordova/lib/PluginHandler.js
@@ -64,6 +64,12 @@ var handlers = {
                 var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder);
                 project.addResourceFileToProject(relativeSrcPath, obj.target, targetConditions);
             } else {
+                // if target already exists, emit warning to consider using a reference instead of copying
+                if (fs.existsSync(path.resolve(project.root, obj.target))) {
+                    events.emit('warn', '<resource-file> with target ' + obj.target + ' already exists and will be overwritten ' +
+                    'by a <resource-file> with the same target. Consider using the attribute reference="true" in the ' +
+                    '<resource-file> tag to avoid overwriting files with the same target. ');
+                }
                 // as per specification resource-file target is specified relative to platform root
                 copyFile(plugin.dir, obj.src, project.root, obj.target);
                 project.addResourceFileToProject(obj.target, obj.target, targetConditions);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org