mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
GH-539 fix destination path fallback
Fallback to old path mapping if no Android Studio path mapping exists Co-authored-by: Christopher J. Brody <chris.brody@gmail.com> Co-authored-by: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
This commit is contained in:
parent
fb1dfb27df
commit
c2f6631f91
9
bin/templates/cordova/lib/pluginHandlers.js
vendored
9
bin/templates/cordova/lib/pluginHandlers.js
vendored
@ -26,7 +26,7 @@ var handlers = {
|
||||
if (!obj.src) throw new CordovaError(generateAttributeError('src', 'source-file', plugin.id));
|
||||
if (!obj.targetDir) throw new CordovaError(generateAttributeError('target-dir', 'source-file', plugin.id));
|
||||
|
||||
var dest = studioPathRemap(obj);
|
||||
var dest = getInstallDestination(obj);
|
||||
|
||||
if (options && options.force) {
|
||||
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
@ -35,7 +35,7 @@ var handlers = {
|
||||
}
|
||||
},
|
||||
uninstall: function (obj, plugin, project, options) {
|
||||
var dest = studioPathRemap(obj);
|
||||
var dest = getInstallDestination(obj);
|
||||
|
||||
// TODO: Add Koltin extension to uninstall, since they are handled like Java files
|
||||
if (obj.src.endsWith('java')) {
|
||||
@ -292,6 +292,11 @@ function generateAttributeError (attribute, element, id) {
|
||||
return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id;
|
||||
}
|
||||
|
||||
function getInstallDestination (obj) {
|
||||
return studioPathRemap(obj) ||
|
||||
path.join(obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
|
||||
function studioPathRemap (obj) {
|
||||
// If a Java file is using the new directory structure, don't penalize it
|
||||
if (!obj.targetDir.includes('app/src/main')) {
|
||||
|
Loading…
Reference in New Issue
Block a user