mirror of
https://github.com/pysunday/sdenv.git
synced 2025-04-08 17:47:08 +08:00
fix: 修复windows路径不兼容问题,与rs-reverse项目同步 #2
This commit is contained in:
parent
2df5873ccf
commit
f9ec8221cb
@ -3,20 +3,19 @@ const fs = require('fs');
|
||||
|
||||
const appDirectory = (() => {
|
||||
// 返回项目根目录
|
||||
const plist = fs.realpathSync(__dirname).split('/');
|
||||
while (!fs.existsSync(path.resolve(plist.join('/'), 'package.json'))) {
|
||||
const plist = path.resolve(__dirname).split(path.sep);
|
||||
while (!fs.existsSync(path.resolve(plist.join(path.sep), 'package.json'))) {
|
||||
plist.pop();
|
||||
if (plist.length === 0) return false;
|
||||
}
|
||||
return plist.join('/');
|
||||
return plist.join(path.sep);
|
||||
})();
|
||||
const resolveApp = (...relativePath) => path.resolve(appDirectory, ...relativePath);
|
||||
|
||||
module.exports = {
|
||||
basePath: resolveApp(''),
|
||||
homePath: __dirname,
|
||||
basePath: resolveApp('.'),
|
||||
modulePath: resolveApp('node_modules'),
|
||||
binPath: resolveApp('node_modules/.bin/'),
|
||||
binPath: resolveApp('node_modules', '.bin/'),
|
||||
package: resolveApp('package.json'),
|
||||
resolve: resolveApp,
|
||||
handlerPath: resolveApp('handler'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user