1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-23 21:09:30 +02:00

Desktop, Cli: Fixed issue when getting version info

This commit is contained in:
Laurent Cozic 2021-04-07 19:12:37 +02:00
parent 5667e687e9
commit 54884d6db4
3 changed files with 17 additions and 9 deletions

View File

@ -59,7 +59,12 @@ try {
keytar = null;
}
shimInit(sharp, keytar);
function appVersion() {
const p = require('./package.json');
return p.version;
}
shimInit(sharp, keytar, null, appVersion);
const application = app();

View File

@ -87,7 +87,12 @@ try {
keytar = null;
}
shimInit(null, keytar, React);
function appVersion() {
const p = require('./packageInfo.js');
return p.version;
}
shimInit(null, keytar, React, appVersion);
// Disable drag and drop of links inside application (which would
// open it as if the whole app was a browser)

View File

@ -62,7 +62,7 @@ const gunzipFile = function(source, destination) {
});
};
function shimInit(sharp = null, keytar = null, React = null) {
function shimInit(sharp = null, keytar = null, React = null, appVersion = null) {
keytar = (shim.isWindows() || shim.isMac()) && !shim.isPortable() ? keytar : null;
shim.fsDriver = () => {
@ -513,12 +513,10 @@ function shimInit(sharp = null, keytar = null, React = null) {
shim.waitForFrame = () => {};
shim.appVersion = () => {
if (shim.isElectron()) {
const p = require('../packageInfo.js');
return p.version;
}
const p = require('../package.json');
return p.version;
if (appVersion) return appVersion();
// Should not happen but don't throw an error because version number is
// used in error messages.
return 'unknown-version!';
};
shim.pathRelativeToCwd = (path) => {