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; keytar = null;
} }
shimInit(sharp, keytar); function appVersion() {
const p = require('./package.json');
return p.version;
}
shimInit(sharp, keytar, null, appVersion);
const application = app(); const application = app();

View File

@ -87,7 +87,12 @@ try {
keytar = null; 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 // Disable drag and drop of links inside application (which would
// open it as if the whole app was a browser) // 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; keytar = (shim.isWindows() || shim.isMac()) && !shim.isPortable() ? keytar : null;
shim.fsDriver = () => { shim.fsDriver = () => {
@ -513,12 +513,10 @@ function shimInit(sharp = null, keytar = null, React = null) {
shim.waitForFrame = () => {}; shim.waitForFrame = () => {};
shim.appVersion = () => { shim.appVersion = () => {
if (shim.isElectron()) { if (appVersion) return appVersion();
const p = require('../packageInfo.js'); // Should not happen but don't throw an error because version number is
return p.version; // used in error messages.
} return 'unknown-version!';
const p = require('../package.json');
return p.version;
}; };
shim.pathRelativeToCwd = (path) => { shim.pathRelativeToCwd = (path) => {