[ 
https://issues.apache.org/jira/browse/CB-14054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16480396#comment-16480396
 ] 

ASF GitHub Bot commented on CB-14054:
-------------------------------------

stevengill closed pull request #7: CB-14054: fixing cordova-android directory 
restructuring. (backward compatible)
URL: https://github.com/apache/cordova-serve/pull/7
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/util.js b/src/util.js
index 242e96f..57cdef2 100644
--- a/src/util.js
+++ b/src/util.js
@@ -25,15 +25,15 @@ var path = require('path');
 // into the actual platform.
 
 var platforms = {
-    amazon_fireos: {www_dir: 'assets/www'},
-    android: {www_dir: 'assets/www'},
-    blackberry10: {www_dir: 'www'},
-    browser: {www_dir: 'www'},
-    firefoxos: {www_dir: 'www'},
-    ios: {www_dir: 'www'},
-    ubuntu: {www_dir: 'www'},
-    windows: {www_dir: 'www'},
-    wp8: {www_dir: 'www'}
+    amazon_fireos: { www_dir: 'assets/www' },
+    android: { www_dir: 'assets/www' },
+    blackberry10: { www_dir: 'www' },
+    browser: { www_dir: 'www' },
+    firefoxos: { www_dir: 'www' },
+    ios: { www_dir: 'www' },
+    ubuntu: { www_dir: 'www' },
+    windows: { www_dir: 'www' },
+    wp8: { www_dir: 'www' }
 };
 
 /**
@@ -76,7 +76,14 @@ function getPlatformWwwRoot (cordovaProjectRoot, 
platformName) {
     if (!platform) {
         throw new Error('Unrecognized platform: ' + platformName);
     }
-    return path.join(cordovaProjectRoot, 'platforms', platformName, 
platform.www_dir);
+
+    try {
+        var Api = require(path.join(cordovaProjectRoot, 'platforms', 
platformName, 'cordova/api'));
+        return new Api().locations.www;
+    } catch (e) {
+        // Fallback on hardcoded paths if platform api not found
+        return path.join(cordovaProjectRoot, 'platforms', platformName, 
platform.www_dir);
+    }
 }
 
 function isRootDir (dir) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> cordova-serve not aware of cordova-android directory restructuring in v7+
> -------------------------------------------------------------------------
>
>                 Key: CB-14054
>                 URL: https://issues.apache.org/jira/browse/CB-14054
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-android, cordova-serve
>    Affects Versions: cordova-android-7.0.0
>         Environment: **
>  * Cordova VS Code extension version: 1.3.9
>  * VSCode version: 1.22.2
>  * OS platform and version: Windows 10 Education x64 v10.0.16299.402
>  * NodeJS version: 8.11.1
>  * Cordova version: 8.0.0
>  * Cordova-Android/iOS/Windows version: 7.0.0 (also tried 7.1.0)
>  
>            Reporter: Russell Allen
>            Assignee: Joe Bowser
>            Priority: Major
>
> The cordova-serve plugin detects the platform {{www}} root wrong: in 
> [email protected] it has moved from {{assets/www}} to {{app/src/main/assets/www}}.
> When using [email protected], the issue doesn't persist.
> Discovered when using VS Code to emulate app (as Android) in browser. Please 
> see [https://github.com/Microsoft/vscode-cordova/issues/386] 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to