电子应用程序名称不会改变

Electron app name doesn#39;t change(电子应用程序名称不会改变)
本文介绍了电子应用程序名称不会改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 electron-packager 打包我的应用程序,但没有更改其名称,并且仍然显示Electron".

i'm packaging my application using electron-packager but isn't changing its name, and still display "Electron".

它应该在我的 package.json 中使用 productName 但它没有改变.

it's supposed to use the productName in my package.json but it doesn't change.

即使我做了一个安装程序,安装的应用程序的名称、快捷方式和进程仍然是Electron

even if i made an installer, the name of the app installed, shortcut and process still is Electron

我已经读到可能问题出在 electron-prebuilt 但我没有将它作为对我的项目的依赖.

i've read that maybe the problem is electron-prebuilt but i didn't have it as a dependency on my project.

知道有什么问题吗?

阅读更多关于 electron-packager 的文档有一个特别适用于 windows 的选项.但是当我使用它们时会抛出一个错误:

reading more on the documentation of electron-packager there's an options especially to windows. but when i use them throws me an error:

Fatal error: Unable to commit changes
undefined

我第一次使用它们时工作"很好地打包了我的应用程序,但仍然显示错误的应用程序名称

the first time i used them was "working" good packaging my app, but still displaying wrong the appname

electron-packager ./ --platform=win32 --arch=ia32 --overwrite=true --appname="TierraDesktop" --version-string.ProductName="TierraDesktop" --version-string=InternalName="TierraDesktop" --version-string.CompanyName="Cosmica" --version-string.FileDescription="Sistema de gestion comercial" --version-string.OriginalFilename="TierraDesktop"

之前使用 --version-string.ProductName 但现在即使使用它仍然会引发该错误.

before was working with --version-string.ProductName but now even with it still throws that error.

在这里,我将把我的 packager.json 留给你,它位于我的项目的根目录上

here i'll leave you my packager.json that's on the root of my project

{
"name": "TierraDesktop",
"productName": "TierraDesktop",
"version": "2.0.5",
"description": "Aplicacion de escritorio tierra de colores",
"main": "main.js",
"scripts": {
    "start": "electron main.js"
},
"repository": {
    "type": "git",
    "url": "git+https://github.com/xxxx/xxxxx.git"
},
"author": "xxxxx",
"devDependencies": {
    "debug-menu": "^0.4.0",
    "electron-winstaller": "^2.3.3"
},
"dependencies": {
    "electron-json-storage": "^2.0.0"
}
}

推荐答案

好的,在尝试和研究之后,我决定通过编程 API 打包我的应用程序

Ok after trying and researching i've decided to package my application via programmatic API

有了这个脚本,我可以实现我想要的一切.希望这可以帮助遇到同样问题的人.

with this script i can achieve all what i want. hope this help someone with the same problem.

var packager = require('electron-packager');
var options = {
    'arch': 'ia32',
    'platform': 'win32',
    'dir': './',
    'app-copyright': 'Paulo Galdo',
    'app-version': '2.0.5',
    'asar': true,
    'icon': './app.ico',
    'name': 'TierraDesktop',
    'ignore': ['./releases', './.git'],
    'out': './releases',
    'overwrite': true,
    'prune': true,
    'version': '1.3.2',
    'version-string':{
      'CompanyName': 'Paulo Galdo',
      'FileDescription': 'Tierra de colores', /*This is what display windows on task manager, shortcut and process*/
      'OriginalFilename': 'TierraDesktop',
      'ProductName': 'Tierra de colores',
      'InternalName': 'TierraDesktop'
    }
};
packager(options, function done_callback(err, appPaths) {
    console.log(err);
    console.log(appPaths);
});

这篇关于电子应用程序名称不会改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
Ordinals in words javascript(javascript中的序数)
getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)