mirror of https://github.com/oxen-io/lokinet
dmg: version, and set icon
- Add the version number into the .dmg filename - Set the lokinet icon on the .dmg. This is done via a swift program because all the Apple CLI tools to do this are deprecated.pull/1983/head
parent
4605b49cfc
commit
500530a336
@ -0,0 +1,26 @@
|
||||
import Foundation
|
||||
import AppKit
|
||||
|
||||
// Apple deprecated their command line tools to set images on things and replaced them with a
|
||||
// barely-documented swift function. Yay!
|
||||
|
||||
// Usage: ./seticon /path/to/my.icns /path/to/some.dmg
|
||||
|
||||
let args = CommandLine.arguments
|
||||
|
||||
if args.count != 3 {
|
||||
print("Error: usage: ./seticon /path/to/my.icns /path/to/some.dmg")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
var icns = args[1]
|
||||
var dmg = args[2]
|
||||
|
||||
var img = NSImage(byReferencingFile: icns)!
|
||||
|
||||
if NSWorkspace.shared.setIcon(img, forFile: dmg) {
|
||||
print("Set \(dmg) icon to \(icns) [\(img.size)]")
|
||||
} else {
|
||||
print("Setting icon failed, don't know why")
|
||||
exit(2)
|
||||
}
|
Loading…
Reference in New Issue