Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new androic project structure #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/server/emulate/cordovaProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ function buildPaths(opts) {
var platforms = fs.readdirSync(path.join(paths.orig, "platforms"));
if (platforms.indexOf('android') >= 0) {
opts.cordova = 'android';
paths.android = path.join(paths.orig, "platforms", "android", "assets", "www");
if(fs.existsSync(path.join(paths.orig, "platforms", "android", "app", "src", "main", "assets", "www"))) {
paths.android = path.join(paths.orig, "platforms", "android", "app", "src", "main", "assets", "www");
} else {
paths.android = path.join(paths.orig, "platforms", "android", "assets", "www");
}
}

if (platforms.indexOf('ios') >= 0) {
Expand All @@ -50,6 +54,8 @@ function buildPaths(opts) {
}
}

// we need these paths later on as wekl
opts.paths = paths;
return paths;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/server/emulate/hosted.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function remoteInjection(opts) {
};
}

function localInjection() {
function localInjection(opts) {

function inject(file, req, res) {
fs.readFile(file, "utf-8", function (err, data) {
Expand Down Expand Up @@ -165,7 +165,7 @@ function localInjection() {
// as of version 3.0 phonegap uses phonegap.js instead of cordova.js
// but the files are identical
if (req.query.phonegap) {
var path = './platforms/' + req.staticPlatform + '/assets/www';
var path = opts.paths[opts.cordova];
fs.readFile(path + '/cordova.js', function(err, data) {
if(err) throw err;
console.log('... copying cordova.js to phonegap.js');
Expand Down