0

There are 2 processes. One is a GUI process that is located in MacOS folder under the Mac bundle, while the other one is a tray process that is located in Resources folder under the bundle. The tray process doesn't seem to be able to find the cocoa plugin/library. Because when I manually run it, there is an error as below

This application failed to start because it could not find or load the Qt platform plugin "cocoa" in "".

The bundle structure looks like this

-Contents
 |_MacOS
 | |_gui
 |
 |_Resources
 | |_tray
 | |_qt.conf
 |
 |_Plugins
   |_platforms
     |_libqcocoa.dylib

qt.conf contains

[Paths]
Plugins = PlugIns
Imports = Resources/qml
Qml2Imports = Resources/qml

Is the right thing to do that putting tray process into resources folder within a Mac bundle?

Jerry
  • 1,704
  • 5
  • 20
  • 40

1 Answers1

1

According the Bundle Programming Guide the Resources folder is intended for resources like images, sounds, etc (see Table 2-5):

Contains all of the application’s resource files. This contents of this directory are further organized to distinguish between localized and nonlocalized resources. For more information about the structure of this directory, see The Resources Directory.

and:

The Resources directory is where you put all of your images, sounds, nib files, string resources, icon files, data files, and configuration files among others

The MacOS folder however may also contain helper executables:

Contains the application’s standalone executable code. Typically, this directory contains only one binary file with your application’s main entry point and statically linked code. However, you may put other standalone executables (such as command-line tools) in this directory as well.

Therefore, I think the MacOS folder is the best location for your tray binary. I don't know whether that solves the problem of the missing platform plugin.

mschmidt
  • 2,740
  • 4
  • 17
  • 31
  • Thank you mschmidt. Your other answer could solve this problem. Also good to know the above. https://stackoverflow.com/questions/49053792/start-a-qt-tray-process-without-dock-icon-on-mac/49060345#49060345 – Jerry Mar 02 '18 at 09:30