1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

[PM-4441] Refactor utils helper functions (#6672)

This commit is contained in:
Oscar Hinton
2023-10-23 23:52:42 +02:00
committed by GitHub
parent 7ff4a157f9
commit 6355a1964b
2 changed files with 36 additions and 17 deletions

View File

@@ -25,8 +25,16 @@ export function isDev() {
return process.defaultApp || /node_modules[\\/]electron[\\/]/.test(process.execPath);
}
export function isLinux() {
return process.platform === "linux";
}
export function isAppImage() {
return process.platform === "linux" && "APPIMAGE" in process.env;
return isLinux() && "APPIMAGE" in process.env;
}
export function isSnapStore() {
return isLinux() && process.env.SNAP_USER_DATA != null;
}
export function isMac() {
@@ -37,25 +45,25 @@ export function isMacAppStore() {
return isMac() && process.mas === true;
}
export function isWindows() {
return process.platform === "win32";
}
export function isWindowsStore() {
const isWindows = process.platform === "win32";
const windows = isWindows();
let windowsStore = process.windowsStore;
if (
isWindows &&
windows &&
!windowsStore &&
process.resourcesPath.indexOf("8bitSolutionsLLC.bitwardendesktop_") > -1
) {
windowsStore = true;
}
return isWindows && windowsStore === true;
}
export function isSnapStore() {
return process.platform === "linux" && process.env.SNAP_USER_DATA != null;
return windows && windowsStore === true;
}
export function isWindowsPortable() {
return process.platform === "win32" && process.env.PORTABLE_EXECUTABLE_DIR != null;
return isWindows() && process.env.PORTABLE_EXECUTABLE_DIR != null;
}
/**