cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [33/50] git commit: ubuntu: check icon existence
Date Fri, 05 Sep 2014 18:14:38 GMT
ubuntu: check icon existence


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/d4ea7900
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/d4ea7900
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/d4ea7900

Branch: refs/heads/master
Commit: d4ea7900f28f50988c756331f6b75b62418c7c9b
Parents: 2b32d93
Author: Maxim Ermilov <maxim.ermilov@canonical.com>
Authored: Tue Aug 19 15:03:48 2014 +0400
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Sep 5 11:12:19 2014 -0700

----------------------------------------------------------------------
 .../src/cordova/metadata/ubuntu_parser.js       | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d4ea7900/cordova-lib/src/cordova/metadata/ubuntu_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/ubuntu_parser.js b/cordova-lib/src/cordova/metadata/ubuntu_parser.js
index 634a575..a199662 100644
--- a/cordova-lib/src/cordova/metadata/ubuntu_parser.js
+++ b/cordova-lib/src/cordova/metadata/ubuntu_parser.js
@@ -87,14 +87,18 @@ module.exports.prototype = {
                          architecture: arch,
                          description: sanitize(this.config.description()) };
 
-        var name = this.config.name().replace(/\n/g, ' '); //FIXME: escaping
-        var content = '[Desktop Entry]\nName=' + name + '\nExec=./cordova-ubuntu www/\nIcon=qmlscene\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true';
-
-        name = sanitize(this.config.name()); //FIXME: escaping
-        content = '[Desktop Entry]\nName=' + name + '\nExec=./cordova-ubuntu www/\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true';
-
-        if (this.config.doc.find('icon') && this.config.doc.find('icon').attrib.src
&& fs.existsSync(path.join(this.path, 'www', this.config.doc.find('icon').attrib.src)))
{
-            content += '\nIcon=www/' + this.config.doc.find('icon').attrib.src;
+        var name = sanitize(this.config.name()); //FIXME: escaping
+        var content = '[Desktop Entry]\nName=' + name + '\nExec=./cordova-ubuntu www/\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true';
+
+        if (this.config.doc.find('icon') && this.config.doc.find('icon').attrib.src)
{
+            var iconPath = path.join(this.path, 'www', this.config.doc.find('icon').attrib.src);
+            if (fs.existsSync(iconPath))
+                content += '\nIcon=www/' + this.config.doc.find('icon').attrib.src;
+            else
+                return Q.reject(new Error('icon does not exist: ' + iconPath));
+        } else {
+            content += '\nIcon=qmlscene';
+            console.warn('missing icon element in config.xml');
         }
         fs.writeFileSync(path.join(this.path, 'manifest.json'), JSON.stringify(manifest));
         fs.writeFileSync(path.join(this.path, 'cordova.desktop'), content);


Mime
View raw message