File tree Expand file tree Collapse file tree 7 files changed +50
-176
lines changed
Expand file tree Collapse file tree 7 files changed +50
-176
lines changed Original file line number Diff line number Diff line change @@ -7,35 +7,17 @@ const os = require('os');
77// 获取当前操作系统类型
88function getOSType ( ) {
99 const platform = os . platform ( ) ;
10- const arch = os . arch ( ) ;
11-
12- let osType = '' ;
13- switch ( platform ) {
14- case 'win32' :
15- osType = 'Windows' ;
16- break ;
17- case 'darwin' :
18- osType = 'macOS' ;
19- break ;
20- case 'linux' :
21- osType = 'Linux' ;
22- break ;
23- case 'freebsd' :
24- osType = 'FreeBSD' ;
25- break ;
26- case 'openbsd' :
27- osType = 'OpenBSD' ;
28- break ;
29- case 'sunos' :
30- osType = 'SunOS' ;
31- break ;
32- default :
33- osType = platform ;
10+ let arch = os . arch ( ) ;
11+
12+ // 根据arch判断是intel还是arm架构
13+ if ( arch . startsWith ( 'arm' ) ) {
14+ arch = 'arm' ;
15+ } else {
16+ arch = 'intel' ;
3417 }
35-
18+
3619 return {
3720 platform : platform ,
38- type : osType ,
3921 arch : arch ,
4022 release : os . release ( ) ,
4123 version : os . version ? os . version ( ) : 'N/A'
Original file line number Diff line number Diff line change @@ -8,35 +8,17 @@ const os = require('os');
88// 获取当前操作系统类型
99function getOSType ( ) {
1010 const platform = os . platform ( ) ;
11- const arch = os . arch ( ) ;
12-
13- let osType = '' ;
14- switch ( platform ) {
15- case 'win32' :
16- osType = 'Windows' ;
17- break ;
18- case 'darwin' :
19- osType = 'macOS' ;
20- break ;
21- case 'linux' :
22- osType = 'Linux' ;
23- break ;
24- case 'freebsd' :
25- osType = 'FreeBSD' ;
26- break ;
27- case 'openbsd' :
28- osType = 'OpenBSD' ;
29- break ;
30- case 'sunos' :
31- osType = 'SunOS' ;
32- break ;
33- default :
34- osType = platform ;
11+ let arch = os . arch ( ) ;
12+
13+ // 根据arch判断是intel还是arm架构
14+ if ( arch . startsWith ( 'arm' ) ) {
15+ arch = 'arm' ;
16+ } else {
17+ arch = 'intel' ;
3518 }
3619
3720 return {
3821 platform : platform ,
39- type : osType ,
4022 arch : arch ,
4123 release : os . release ( ) ,
4224 version : os . version ? os . version ( ) : 'N/A'
Original file line number Diff line number Diff line change @@ -8,35 +8,17 @@ const os = require('os');
88// 获取当前操作系统类型
99function getOSType ( ) {
1010 const platform = os . platform ( ) ;
11- const arch = os . arch ( ) ;
12-
13- let osType = '' ;
14- switch ( platform ) {
15- case 'win32' :
16- osType = 'Windows' ;
17- break ;
18- case 'darwin' :
19- osType = 'macOS' ;
20- break ;
21- case 'linux' :
22- osType = 'Linux' ;
23- break ;
24- case 'freebsd' :
25- osType = 'FreeBSD' ;
26- break ;
27- case 'openbsd' :
28- osType = 'OpenBSD' ;
29- break ;
30- case 'sunos' :
31- osType = 'SunOS' ;
32- break ;
33- default :
34- osType = platform ;
11+ let arch = os . arch ( ) ;
12+
13+ // 根据arch判断是intel还是arm架构
14+ if ( arch . startsWith ( 'arm' ) ) {
15+ arch = 'arm' ;
16+ } else {
17+ arch = 'intel' ;
3518 }
3619
3720 return {
3821 platform : platform ,
39- type : osType ,
4022 arch : arch ,
4123 release : os . release ( ) ,
4224 version : os . version ? os . version ( ) : 'N/A'
Original file line number Diff line number Diff line change @@ -7,35 +7,17 @@ const os = require('os');
77// 获取当前操作系统类型
88function getOSType ( ) {
99 const platform = os . platform ( ) ;
10- const arch = os . arch ( ) ;
11-
12- let osType = '' ;
13- switch ( platform ) {
14- case 'win32' :
15- osType = 'Windows' ;
16- break ;
17- case 'darwin' :
18- osType = 'macOS' ;
19- break ;
20- case 'linux' :
21- osType = 'Linux' ;
22- break ;
23- case 'freebsd' :
24- osType = 'FreeBSD' ;
25- break ;
26- case 'openbsd' :
27- osType = 'OpenBSD' ;
28- break ;
29- case 'sunos' :
30- osType = 'SunOS' ;
31- break ;
32- default :
33- osType = platform ;
10+ let arch = os . arch ( ) ;
11+
12+ // 根据arch判断是intel还是arm架构
13+ if ( arch . startsWith ( 'arm' ) ) {
14+ arch = 'arm' ;
15+ } else {
16+ arch = 'intel' ;
3417 }
3518
3619 return {
3720 platform : platform ,
38- type : osType ,
3921 arch : arch ,
4022 release : os . release ( ) ,
4123 version : os . version ? os . version ( ) : 'N/A'
Original file line number Diff line number Diff line change @@ -7,35 +7,17 @@ const os = require('os');
77// 获取当前操作系统类型
88function getOSType ( ) {
99 const platform = os . platform ( ) ;
10- const arch = os . arch ( ) ;
11-
12- let osType = '' ;
13- switch ( platform ) {
14- case 'win32' :
15- osType = 'Windows' ;
16- break ;
17- case 'darwin' :
18- osType = 'macOS' ;
19- break ;
20- case 'linux' :
21- osType = 'Linux' ;
22- break ;
23- case 'freebsd' :
24- osType = 'FreeBSD' ;
25- break ;
26- case 'openbsd' :
27- osType = 'OpenBSD' ;
28- break ;
29- case 'sunos' :
30- osType = 'SunOS' ;
31- break ;
32- default :
33- osType = platform ;
10+ let arch = os . arch ( ) ;
11+
12+ // 根据arch判断是intel还是arm架构
13+ if ( arch . startsWith ( 'arm' ) ) {
14+ arch = 'arm' ;
15+ } else {
16+ arch = 'intel' ;
3417 }
3518
3619 return {
3720 platform : platform ,
38- type : osType ,
3921 arch : arch ,
4022 release : os . release ( ) ,
4123 version : os . version ? os . version ( ) : 'N/A'
Original file line number Diff line number Diff line change @@ -8,35 +8,17 @@ const os = require('os');
88// 获取当前操作系统类型
99function getOSType ( ) {
1010 const platform = os . platform ( ) ;
11- const arch = os . arch ( ) ;
12-
13- let osType = '' ;
14- switch ( platform ) {
15- case 'win32' :
16- osType = 'Windows' ;
17- break ;
18- case 'darwin' :
19- osType = 'macOS' ;
20- break ;
21- case 'linux' :
22- osType = 'Linux' ;
23- break ;
24- case 'freebsd' :
25- osType = 'FreeBSD' ;
26- break ;
27- case 'openbsd' :
28- osType = 'OpenBSD' ;
29- break ;
30- case 'sunos' :
31- osType = 'SunOS' ;
32- break ;
33- default :
34- osType = platform ;
11+ let arch = os . arch ( ) ;
12+
13+ // 根据arch判断是intel还是arm架构
14+ if ( arch . startsWith ( 'arm' ) ) {
15+ arch = 'arm' ;
16+ } else {
17+ arch = 'intel' ;
3518 }
3619
3720 return {
3821 platform : platform ,
39- type : osType ,
4022 arch : arch ,
4123 release : os . release ( ) ,
4224 version : os . version ? os . version ( ) : 'N/A'
Original file line number Diff line number Diff line change @@ -7,35 +7,17 @@ const os = require('os');
77// 获取当前操作系统类型
88function getOSType ( ) {
99 const platform = os . platform ( ) ;
10- const arch = os . arch ( ) ;
11-
12- let osType = '' ;
13- switch ( platform ) {
14- case 'win32' :
15- osType = 'Windows' ;
16- break ;
17- case 'darwin' :
18- osType = 'macOS' ;
19- break ;
20- case 'linux' :
21- osType = 'Linux' ;
22- break ;
23- case 'freebsd' :
24- osType = 'FreeBSD' ;
25- break ;
26- case 'openbsd' :
27- osType = 'OpenBSD' ;
28- break ;
29- case 'sunos' :
30- osType = 'SunOS' ;
31- break ;
32- default :
33- osType = platform ;
10+ let arch = os . arch ( ) ;
11+
12+ // 根据arch判断是intel还是arm架构
13+ if ( arch . startsWith ( 'arm' ) ) {
14+ arch = 'arm' ;
15+ } else {
16+ arch = 'intel' ;
3417 }
3518
3619 return {
3720 platform : platform ,
38- type : osType ,
3921 arch : arch ,
4022 release : os . release ( ) ,
4123 version : os . version ? os . version ( ) : 'N/A'
You can’t perform that action at this time.
0 commit comments