I want to use the app’s internal icon images in my script UI (in my case, line end shapes). Simply specifying the app location like “Applications/Glyphs 3.app/Contents/…” will cause an error for the users who rename the app. Is there a safe way to refer to the app’s location?
Usually you can use
bundle = NSBundle.bundleForClass_(NSClassFromString("GSFont")) # (1)
image = bundle.imageForResource_("imageName") # (2)
- Find a class that is in the bundle that the image is in (if it is in the main app and not in e.g. GlyphsCore, you can use
NSBundle.mainBundle()
- the full file name of the image without the suffix.
Thanks, it works!