Get path of system image from within Julia?

If I create a custom system image using PackageCompiler, and then start julia using that image like

$ julia -Jcustom_sysimage.so

is there a way to get the path to custom_sysimage.so from within julia?

The reason I ask is that I’d like to check that the image is newer than my source code in order to be able to warn the user when they might want to re-build the system image.

1 Like

There must be a better way, but here is a lead.

unsafe_string(Base.JLOptions().image_file)
1 Like

Thanks @mkitti, that does work for what I wanted!