Skip to content

Commit

Permalink
fix(osx): set NSHumanReadableCopyright
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayushman Chhabra committed Jul 19, 2023
1 parent 81dd2cd commit 5efa28d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/bld/osxCfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,33 @@ const setOsxConfig = async (app, outDir) => {
const infoPlistPath = resolve(outApp, "Contents", "Info.plist");
const infoPlistJson = plist.parse(await readFile(infoPlistPath, "utf-8"));

const infoPlistStringsPath = resolve(
outApp,
"Contents",
"Resources",
"en.lproj",
"InfoPlist.strings"
);
const infoPlistStringsData = await readFile(infoPlistStringsPath, "utf-8");

let infoPlistStringsDataArray = infoPlistStringsData.split("\n");

infoPlistStringsDataArray.forEach((line, idx, arr) => {
if (line.includes("NSHumanReadableCopyright")) {
arr[
idx
] = `NSHumanReadableCopyright = "${app.NSHumanReadableCopyright}";`;
console.log(arr);
}
});

infoPlistJson.LSApplicationCategoryType = app.LSApplicationCategoryType;
infoPlistJson.CFBundleIdentifier = app.CFBundleIdentifier;
infoPlistJson.CFBundleName = app.CFBundleName;
infoPlistJson.CFBundleDisplayName = app.CFBundleDisplayName;
infoPlistJson.CFBundleSpokenName = app.CFBundleSpokenName;
infoPlistJson.CFBundleVersion = app.CFBundleVersion;
infoPlistJson.CFBundleShortVersionString = app.CFBundleShortVersionString;
infoPlistJson.NSHumanReadableCopyright = app.NSHumanReadableCopyright;

Object.keys(infoPlistJson).forEach((option) => {
if (infoPlistJson[option] === undefined) {
Expand All @@ -64,6 +83,10 @@ const setOsxConfig = async (app, outDir) => {
});

await writeFile(infoPlistPath, plist.build(infoPlistJson));
await writeFile(
infoPlistStringsPath,
infoPlistStringsDataArray.toString().replace(/,/g, "\n")
);
} catch (error) {
log.error(error);
}
Expand Down

0 comments on commit 5efa28d

Please sign in to comment.