Github user vladimir-kotikov commented on a diff in the pull request: https://github.com/apache/cordova-windows/pull/213#discussion_r92344997 --- Diff: template/cordova/lib/PluginHandler.js --- @@ -53,18 +53,37 @@ var handlers = { }, 'resource-file':{ install:function(obj, plugin, project, options) { - // do not copy, but reference the file in the plugin folder. This allows to - // have multiple source files map to the same target and select the appropriate - // one based on the current build settings, e.g. architecture. - // also, we don't check for existence. This allows to insert build variables - // into the source file name, e.g. - // <resource-file src="$(Platform)/My.dll" target="My.dll" /> - var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder); - project.addResourceFileToProject(relativeSrcPath, obj.target, getTargetConditions(obj)); + var targetConditions = getTargetConditions(obj); + if (targetConditions.reference) { + // do not copy, but reference the file in the plugin folder. This allows to + // have multiple source files map to the same target and select the appropriate + // one based on the current build settings, e.g. architecture. + // also, we don't check for existence. This allows to insert build variables + // into the source file name, e.g. + // <resource-file src="$(Platform)/My.dll" target="My.dll" /> + 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. '); --- End diff -- Might be also useful to add that adding `reference` will not copy user files to destination directory. WDYT?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org