forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
25 lines (22 loc) · 1010 Bytes
/
utils.js
File metadata and controls
25 lines (22 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import path from 'path'
import { isFile } from 'common/filesystem'
/// Check whether the package is updatable at runtime.
export const isUpdatable = () => {
// TODO: If not updatable, allow to check whether there is a new version available.
const resFile = isFile(path.join(process.resourcesPath, 'app-update.yml'))
if (!resFile) {
// No update resource file available.
return false
} else if (process.env.APPIMAGE) {
// We are running as AppImage.
return true
} else if (process.platform === 'win32' && isFile(path.join(process.resourcesPath, 'md.ico'))) {
// Windows is a little but tricky. The update resource file is always available and
// there is no way to check the target type at runtime (electron-builder#4119).
// As workaround we check whether "md.ico" exists that is only included in the setup.
return true
}
// Otherwise assume that we cannot perform an auto update (standalone binary, archives,
// packed for package manager).
return false
}