mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
Cleanup getInstallDestination in pluginHandlers.js (PR #550)
This commit is contained in:
parent
9537e3468b
commit
07e1fe18ff
23
bin/templates/cordova/lib/pluginHandlers.js
vendored
23
bin/templates/cordova/lib/pluginHandlers.js
vendored
@ -318,20 +318,17 @@ function generateAttributeError (attribute, element, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getInstallDestination (obj) {
|
function getInstallDestination (obj) {
|
||||||
return studioPathRemap(obj) ||
|
var APP_MAIN_PREFIX = 'app/src/main';
|
||||||
path.join(obj.targetDir, path.basename(obj.src));
|
|
||||||
}
|
|
||||||
|
|
||||||
function studioPathRemap (obj) {
|
if (obj.targetDir.includes('app')) {
|
||||||
// If any source file is using the app new directory structure,
|
// If any source file is using the app new directory structure,
|
||||||
// don't penalize it
|
// don't penalize it
|
||||||
if (!obj.targetDir.includes('app')) {
|
return path.join(obj.targetDir, path.basename(obj.src));
|
||||||
if (obj.src.endsWith('.java')) {
|
} else if (obj.src.endsWith('.java')) {
|
||||||
return path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src));
|
return path.join(APP_MAIN_PREFIX, 'java', obj.targetDir.substring(4), path.basename(obj.src));
|
||||||
} else {
|
} else {
|
||||||
// For all other files, add 'app/src/main' to the targetDir if it didn't have it already
|
// For all other files, add 'app/src/main' to the targetDir if it didn't have it already
|
||||||
return path.join('app/src/main', obj.targetDir, path.basename(obj.src));
|
return path.join(APP_MAIN_PREFIX, obj.targetDir, path.basename(obj.src));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user