mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
允许使用NAPCAT_WRITEPATH环境变量指定napcat工作路径。
This commit is contained in:
@@ -13,11 +13,15 @@ export class NapCatPathWrapper {
|
|||||||
constructor(mainPath: string = dirname(fileURLToPath(import.meta.url))) {
|
constructor(mainPath: string = dirname(fileURLToPath(import.meta.url))) {
|
||||||
this.binaryPath = mainPath;
|
this.binaryPath = mainPath;
|
||||||
let writePath: string;
|
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');
|
writePath = path.join(os.homedir(), 'Library', 'Application Support', 'QQ', 'NapCat');
|
||||||
} else {
|
} else {
|
||||||
writePath = this.binaryPath;
|
writePath = this.binaryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logsPath = path.join(writePath, 'logs');
|
this.logsPath = path.join(writePath, 'logs');
|
||||||
this.configPath = path.join(writePath, 'config');
|
this.configPath = path.join(writePath, 'config');
|
||||||
this.cachePath = path.join(writePath, 'cache');
|
this.cachePath = path.join(writePath, 'cache');
|
||||||
|
Reference in New Issue
Block a user