fix: process.env.PWD is not set on win10

This commit is contained in:
chenos 2021-10-25 13:40:02 +08:00
parent 90b7c9fc94
commit 2a696eeb7a

View File

@ -12,7 +12,7 @@ export function getDocumentRoot(storage): string {
// TODO(feature): 后面考虑以字符串模板的方式使用,可注入 req/action 相关变量,以便于区分文件夹
return path.resolve(path.isAbsolute(documentRoot)
? documentRoot
: path.join(process.env.PWD, documentRoot), storage.path);
: path.join(process.cwd(), documentRoot), storage.path);
}
// TODO(optimize): 初始化的时机不应该放在中间件里