Skip to content
This repository was archived by the owner on Oct 19, 2020. It is now read-only.
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ You also can specify manually a location for your `config.xml` or `splash.png`:

$ cordova-splash --config=config.xml --splash=splash.png

In case you want to specify a different splash image for landscape mode create either a `splash-landscape.png` or run:

$ cordova-splash --splash-landscape=splash-landscape.png

If you run a old version of Cordova for iOS and you need your files in `/Resources/icons/`, use this option:

$ cordova-splash --xcode-old
Expand Down
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var argv = require('minimist')(process.argv.slice(2));
var settings = {};
settings.CONFIG_FILE = argv.config || 'config.xml';
settings.SPLASH_FILE = argv.splash || 'splash.png';
settings.SPLASH_FILE_LANDSCAPE = argv['splash-landscape'] || 'splash-landscape.png';
settings.OLD_XCODE_PATH = argv['xcode-old'] || false;

/**
Expand Down Expand Up @@ -143,6 +144,9 @@ var getProjectName = function () {
var generateSplash = function (platform, splash) {
var deferred = Q.defer();
var srcPath = settings.SPLASH_FILE;
if (splash.width > splash.height) {
srcPath = settings.SPLASH_FILE_LANDSCAPE;
}
var platformPath = srcPath.replace(/\.png$/, '-' + platform.name + '.png');
if (fs.existsSync(platformPath)) {
srcPath = platformPath;
Expand Down Expand Up @@ -248,7 +252,15 @@ var validSplashExists = function () {
fs.exists(settings.SPLASH_FILE, function (exists) {
if (exists) {
display.success(settings.SPLASH_FILE + ' exists');
deferred.resolve();
fs.exists(settings.SPLASH_FILE_LANDSCAPE, function (exists) {
if (exists) {
display.success(settings.SPLASH_FILE_LANDSCAPE + ' exists');
} else {
display.error(settings.SPLASH_FILE + ' does not exist, using ' + settings.SPLASH_FILE);
settings.SPLASH_FILE_LANDSCAPE = settings.SPLASH_FILE;
}
deferred.resolve();
});
} else {
display.error(settings.SPLASH_FILE + ' does not exist');
deferred.reject();
Expand Down