Skip to content

Commit

Permalink
fixes to fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Nov 27, 2024
1 parent e4b884e commit e75e008
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/nexrender-action-fonts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ const { name } = require("./package.json");

const installMac = async (settings, job, fontpath) => {
const fontdir = path.join(process.env.HOME, "Library", "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}...`);
fs.copyFileSync(fontpath, path.join(fontdir, path.basename(fontpath)));
settings.logger.log(`[action-fonts] Installing font ${fontpath} to ${fontdest}...`);
fs.copyFileSync(fontpath, fontdest);

return 1;
};
Expand All @@ -34,7 +35,7 @@ const installWin = async (settings, job, fontpath) => {
return 0;
}

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

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

0 comments on commit e75e008

Please sign in to comment.