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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--- ts/util/os/shared.std.ts.orig 2023-10-19 19:29:53 UTC
+++ ts/util/os/shared.std.ts
@@ -23,6 +23,7 @@ export type OSType = {
getClassName: () => string;
getName: () => string;
isLinux: (minVersion?: string) => boolean;
+ isFreeBSD: (minVersion?: string) => boolean;
isMacOS: (minVersion?: string) => boolean;
isWindows: (minVersion?: string) => boolean;
};
@@ -31,6 +32,7 @@ export function getOSFunctions(osRelease: string): OST
const isMacOS = createIsPlatform('darwin', osRelease);
const isLinux = createIsPlatform('linux', osRelease);
const isWindows = createIsPlatform('win32', osRelease);
+ const isFreeBSD = createIsPlatform('freebsd', osRelease);
const getName = (): string => {
if (isMacOS()) {
@@ -39,6 +41,9 @@ export function getOSFunctions(osRelease: string): OST
if (isWindows()) {
return 'Windows';
}
+ if (isFreeBSD()) {
+ return 'FreeBSD';
+ }
return 'Linux';
};
@@ -49,6 +54,9 @@ export function getOSFunctions(osRelease: string): OST
if (isWindows()) {
return 'os-windows';
}
+ if (isFreeBSD()) {
+ return 'os-freebsd';
+ }
return 'os-linux';
};
@@ -58,5 +66,6 @@ export function getOSFunctions(osRelease: string): OST
isLinux,
isMacOS,
isWindows,
+ isFreeBSD,
};
}
|