feat: support macOS

This commit is contained in:
Hao Guan committed 2024-09-03 20:17:10 +08:00
1 parent 7088294d8f
commit 2c67314a83
6 files changed
+33 -4

No files matched your search

+9 -1
View File
@@ -157,13 +157,21 @@ export function getDefaultQQVersionConfigInfo(): QQVersionConfigType {
}
export function getQQPackageInfoPath(exePath: string = ''): string {
return path.join(path.dirname(exePath), 'resources', 'app', 'package.json');
if (os.platform() === 'darwin') {
return path.join(path.dirname(exePath), '..', 'Resources', 'app', 'package.json');
} else {
return path.join(path.dirname(exePath), 'resources', 'app', 'package.json');
}
}
export function getQQVersionConfigPath(exePath: string = ''): string | undefined {
let configVersionInfoPath;
if (os.platform() === 'win32') {
configVersionInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'versions', 'config.json');
} else if (os.platform() === 'darwin') {
const userPath = os.homedir();
const appDataPath = path.resolve(userPath, './Library/Application Support/QQ');
configVersionInfoPath = path.resolve(appDataPath, './versions/config.json');
} else {
const userPath = os.homedir();
const appDataPath = path.resolve(userPath, './.config/QQ');