Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function addLicenseToDmg(packager: PlatformPackager, dmgPath: string) {
// http://www.owsiak.org/?p=700
const licenseFiles = await getLicenseFiles(packager)
if (licenseFiles.length === 0) {
return
}
if (debug.enabled) {
debug(`License files: ${licenseFiles.join(" ")}`)
}
let data = await readFile(path.join(__dirname, "..", "..", "templates", "dmg", "license.txt"), "utf8")
let counter = 5000
for (const item of licenseFiles) {
const kind = item.file.toLowerCase().endsWith(".rtf") ? "RTF" : "TEXT"
data += `data '${kind}' (${counter}, "${item.langName} SLA") {\n`
const hex = (await readFile(item.file)).toString("hex").toUpperCase()
for (let i = 0; i < hex.length; i += 32) {
data += '$"' + hex.substring(i, Math.min(i + 32, hex.length)) + '"\n'
}
data += "};\n\n"
// noinspection SpellCheckingInspection