允许使用NAPCAT_WRITEPATH环境变量指定napcat工作路径。

This commit is contained in:
Neboer
2025-05-26 04:59:20 +00:00
parent 5d57780e84
commit 5cd682e69f

View File

@@ -13,11 +13,15 @@ export class NapCatPathWrapper {
constructor(mainPath: string = dirname(fileURLToPath(import.meta.url))) {
this.binaryPath = mainPath;
let writePath: string;
if (os.platform() === 'darwin') {
if (process.env['NAPCAT_WRITEPATH']) {
writePath = process.env['NAPCAT_WRITEPATH'];
} else if (os.platform() === 'darwin') {
writePath = path.join(os.homedir(), 'Library', 'Application Support', 'QQ', 'NapCat');
} else {
writePath = this.binaryPath;
}
this.logsPath = path.join(writePath, 'logs');
this.configPath = path.join(writePath, 'config');
this.cachePath = path.join(writePath, 'cache');