fix: try support win7

This commit is contained in:
手瓜一十雪
2024-05-12 16:21:04 +08:00
parent a6c056a894
commit 2a6b17a48e
2 changed files with 9 additions and 2 deletions

View File

@@ -1,10 +1,18 @@
import os from 'node:os';
import path from 'node:path';
// 缓解Win7设备兼容性问题
let osName: string;
try {
osName = os.hostname();
} catch (e) {
osName = "NapCat"
}
export const systemPlatform = os.platform();
export const cpuArch = os.arch();
export const systemVersion = os.release();
export const hostname = os.hostname();
export const hostname = osName;
const homeDir = os.homedir();
export const downloadsPath = path.join(homeDir, 'Downloads');
export const systemName = os.type();