On Sat, Jul 10, 2021 at 11:43 AM Programmingkid <programmingk...@gmail.com> wrote: > > > > > On Jul 8, 2021, at 8:15 PM, Akihiko Odaki <akihiko.od...@gmail.com> wrote: > > > > I tried [NSApp applicationIconImage] but had no luck. I suspect it is > > because Rez is for Carbon development and deprecated while NSApp is > > from AppKit. Loading from the filesystem is inevitable. > > Totally disagree. I'm on a new MacBook Air and the rez command is available. > I will agree that Apple likes removing features but the rez command is not > one of them.
I also think Apple is going to remove Rez anytime soon since the documentation also says it is deprecated since Xcode 6, which was released 2014. It is true that the manual says it's deprecated and Apple doesn't want us to use it but we can actually use it, of course. I'd also like to hear opinions from maintainers. Peter, what do you think? I'm also adding Paolo Bonzini who merged the change introducing Rez. > I did not try [NSApp applicationIconImage], but I did try using [[NSWorkspace > sharedWorkspace] iconForFile: program_path] and it worked. I meant it still needs filesystem access. Filesystem access is always a cause of headache. The problem in [[NSWorkspace sharedWorkspace] iconForFile: program_path] I tried to address is also because of the filesystem. It constructs a path from argv and mainBundle but argv is not reliable to get the path of executable. Note that you still can get the executable path in a reliable manner with _NSGetExecutablePath(); a proper fix is to use the function if we opt to use the executable as the icon source. Regards, Akihiko Odaki > > > By the way, I knew Rez is from Carbon but didn't know it is > > deprecated, which I have figured out just now by reading man. Reading > > the icon file and assigning it to [NSApp applicationIconImage] is a > > possible solution, but it requires modifications for all graphical > > backends (cocoa, gtk, and sdl) and of course an external icon file. Do > > you think removing the dependency on Rez is worth it? > > I do not think we should remove any code that depends on rez. I honestly > think the easiest and best thing to do is to go back to using my original > patch for displaying a picture in the About dialog. > > > > See "[PATCH 1/4] cutils: Introduce bundle mechanism" for a general fix > > of the problem when loading a "bundled" file. > > > > Regards, > > Akihiko Odaki > > > > > > On Fri, Jul 9, 2021 at 2:51 AM Peter Maydell <peter.mayd...@linaro.org> > > wrote: > >> > >> On Thu, 8 Jul 2021 at 17:28, Programmingkid <programmingk...@gmail.com> > >> wrote: > >>> The problem with e31746ecf8dd2f25f687c94ac14016a3ba5debfc is it requires a > >>> picture file to be found in a certain path. My original code used QEMU's > >>> icon to obtain a picture. The reason why the picture in the About dialog > >>> stopped appearing was because of the move to the meson build system. > >>> A new patch has just been committed that fixes the missing icon issue. > >>> Using 'git revert e31746ecf8dd2f25f687c94ac14016a3ba5debfc' fixes the > >>> missing picture issue in the About dialog. > >> > >> If the icon is the same (same resolution, etc) then just using it > >> does seem better than loading it off the filesystem. But we should > >> also sort out why get_relocated_path() isn't working, because if QEMU. > >> can't load files that way then other things will also be broken I think. > >> > >> -- PMM >