更新运行时资源查找路径
This commit is contained in:
@@ -144,8 +144,12 @@ function getZitiDir(): string {
|
||||
console.warn('[FontManager] 所有 ziti 路径都不存在,返回默认路径');
|
||||
return path.join(fallbackRoot, 'resources-bundles', 'ziti');
|
||||
} else {
|
||||
// 开发环境:ziti 在项目根目录
|
||||
// 开发环境:ziti 在 packaging/vendor/ziti
|
||||
const appRoot = getAppRoot();
|
||||
const devZitiDir = path.join(appRoot, 'packaging', 'vendor', 'ziti');
|
||||
if (fs.existsSync(devZitiDir)) {
|
||||
return devZitiDir;
|
||||
}
|
||||
return path.join(appRoot, 'ziti');
|
||||
}
|
||||
}
|
||||
@@ -251,7 +255,11 @@ function scanZitiFonts(): any[] {
|
||||
*/
|
||||
function getBundledFonts(): any[] {
|
||||
const appRoot = getAppRoot();
|
||||
const metadataFile = path.join(appRoot, 'fonts', 'bundled', 'fonts_metadata.json');
|
||||
const metadataCandidates = [
|
||||
path.join(appRoot, 'packaging', 'vendor', 'fonts', 'bundled', 'fonts_metadata.json'),
|
||||
path.join(appRoot, 'fonts', 'bundled', 'fonts_metadata.json'),
|
||||
];
|
||||
const metadataFile = metadataCandidates.find(file => fs.existsSync(file)) || metadataCandidates[0];
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(metadataFile)) {
|
||||
@@ -554,6 +562,9 @@ function getBundledFontDirs(): string[] {
|
||||
pushIfExists(path.join(bundleRoot, 'fonts', 'ziti'));
|
||||
}
|
||||
|
||||
pushIfExists(path.join(appRoot, 'packaging', 'vendor', 'ziti'));
|
||||
pushIfExists(path.join(appRoot, 'packaging', 'vendor', 'fonts'));
|
||||
pushIfExists(path.join(appRoot, 'packaging', 'vendor', 'fonts', 'ziti'));
|
||||
pushIfExists(path.join(appRoot, 'ziti'));
|
||||
pushIfExists(path.join(appRoot, 'resources-bundles', 'ziti'));
|
||||
pushIfExists(path.join(appRoot, 'resources-bundles', 'fonts'));
|
||||
|
||||
Reference in New Issue
Block a user