在没有写入权限时记录warn日志

This commit is contained in:
WuYafeng
2024-12-31 22:38:01 +08:00
committed by GitHub
parent 041f725748
commit 42cee0d018

View File

@@ -104,6 +104,9 @@ export class WebUiConfigWrapper {
if (await fs.access(configPath, constants.W_OK).then(() => true).catch(() => false)) { if (await fs.access(configPath, constants.W_OK).then(() => true).catch(() => false)) {
await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 4)); await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 4));
} }
else {
console.warn(`文件: ${configPath} 没有写入权限, 配置的更改部分可能会在重启后还原.`);
}
// 不希望回写的配置放后面 // 不希望回写的配置放后面
// 查询主机地址是否可用 // 查询主机地址是否可用