Skip to content

Commit

Permalink
De-duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
EastArctica committed Aug 14, 2023
1 parent 2565537 commit c001080
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ export const CONFIG_PATHS = Object.fromEntries(
}),
) as Record<(typeof CONFIG_FOLDER_NAMES)[number], string>;

if (process.platform === "linux") {
const { uid: REAL_UID, gid: REAL_GID } = statSync(join(CONFIG_PATH, ".."));
const { uid: REAL_UID, gid: REAL_GID } = statSync(join(CONFIG_PATH, ".."));
const shouldChown = process.platform === "linux";
if (shouldChown) {
chownSync(CONFIG_PATH, REAL_UID, REAL_GID);
CONFIG_FOLDER_NAMES.forEach((folder) => chownSync(join(CONFIG_PATH, folder), REAL_UID, REAL_GID));
}

const QUICK_CSS_FILE = join(CONFIG_PATHS.quickcss, "main.css");
if (!existsSync(QUICK_CSS_FILE)) {
writeFileSync(QUICK_CSS_FILE, "");
if (process.platform === "linux") {
const { uid: REAL_UID, gid: REAL_GID } = statSync(join(CONFIG_PATH, ".."));
if (shouldChown) {
chownSync(QUICK_CSS_FILE, REAL_UID, REAL_GID);
}
}

0 comments on commit c001080

Please sign in to comment.