[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    KDE4/Mac: resources in application bundles?
From:       Jonas_Bähr <jonas.baehr () web ! de>
Date:       2007-11-19 13:51:52
Message-ID: 541F1F84-E748-43B6-9366-B384AB0B3090 () web ! de
[Download RAW message or body]

Hi,

We're currently porting a our application to KDE4 and I also want to  
provide a Version for Mac OS X. Especially for 3rd party applications  
it would be usefull to provide the apps resources within an  
application bundle for Mac OS X. It would be quite simply if  
KStandardDirs would also search the application bundles content for  
the requested resources.

To achieve this I propose the following addition (#ifdef'ed Q_WS_MACX):
Test if the last path elements of argv[0] are "Contents/MacOS". If  
that's the case, add the dirname of "MacOS" to KStandardDirs' prefix  
(just after KDEHOME but before KDE's prefix)
So if my application is installed in (or better: just copied to) "/ 
Applications/MyApp.app" the real executable could be found in "/ 
Applications/MyApp/Contents/MacOS/myapp". I propose to add  
KStandardDirs::addPrefix("/Applications/MyApp/Contents/") in that case.
Inside of MyApp.app/Contents we would find the normal kde directory  
structure, stating with "share". Following [1] this would not clash  
with OS-X's bundle content.
This way I could for example deliver my myappui.rc as "MyApp.app/ 
Contents/share/apps/myapp/myappui.rc" or a default config as  
"MyApp.app/Contents/share/config/myapp.rc"

Do there already exists other ways I've not found? Is it already to  
late to develop a patch for KDElibs? I would put the code in kdeui/ 
kernel/kapplication_mac.cpp and call it from the end of  
KApplication's ctor. Would this be the right approach? Setting the  
prefix directly in my application works fine...

[1] http://developer.apple.com/documentation/CoreFoundation/ 
Conceptual/CFBundles/index.html#//apple_ref/doc/uid/10000123i

bye,
Jonas
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic