Skip to content

Commit

Permalink
fixed win check
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Nov 5, 2024
1 parent efc0af4 commit e4b6798
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/nexrender-action-fonts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ const installMac = async (settings, job, fontpath) => {

const installWin = async (settings, job, fontpath) => {
const fontdir = path.join(process.env.LOCALAPPDATA, "Microsoft", "Windows", "Fonts");
const fontdest = path.join(fontdir, path.basename(fontpath));

if (!fs.existsSync(fontdir)) {
fs.mkdirSync(fontdir, { recursive: true });
}

if (fs.existsSync(fontpath)) {
settings.logger.log(`[action-fonts] Font ${fontpath} already exists, skipping.`);
if (fs.existsSync(fontdest)) {
settings.logger.log(`[action-fonts] Font ${fontdest} already exists, skipping.`);
return 0;
}

settings.logger.log(`[action-fonts] Installing font ${fontpath} to ${fontdir}...`);

const fontdest = path.join(fontdir, path.basename(fontpath));
fs.copyFileSync(fontpath, fontdest);

const fontdisplayname = path.basename(fontpath, path.extname(fontpath)).replace(/-/g, " ");
Expand Down

0 comments on commit e4b6798

Please sign in to comment.