Page 1 of 3

plistTool for OS X

Posted: Tue Mar 12, 2013 9:15 am
by wilbert
A little tool Joe and I made to set Info.plist information from within a PureBasic source.

Configure Tools in PureBasic
  • Open "Configure Tools..."
  • Select "New"
  • Commandline: open
  • Arguments: /Applications/plistTool.app --args "%COMPILEFILE" "%EXECUTABLE" "%PATH"
  • Name: plist Tool
  • Event to trigger the tool: After Compile/Run
  • Select - "Wait until tool quits"
  • Select - "Hide Tool from the Main menu"
  • Click "Ok"
If you wish, you can add the tool a second time with
Event to trigger the tool: After Create Executable

Download plistTool v1.1 (Developer signed for OS X 10.6+)

Image


Usage
Within the PureBasic source code, you can use ;@@ to set something in the Info.plist file and ;@R to embed a resource.
By default the tool shows a window with information. If you don't want to show this, you can use
;@@ DisableDebugWindow
This doesn't disable the PureBasic debug window, only the window of the tool.

Example

Code: Select all

;@@ LSMinimumSystemVersion = 10.6
;@R MyImage.png

MessageRequester("Test", "Test application")
To set something other than a string, you can use XML notation like this

Code: Select all

;@@ <key>CFBundleTypeExtensions</key> 
;@@ <array> 
;@@ <string>ext</string> 
;@@ </array>
The advantage of this tool is that you don't have to modify the Info.plist file manually after creation.
It allows you to use the debug feature of PureBasic with the Info.plist settings set as you wish and resources included.

ScreenShot
Image

Re: plistTool for OS X

Posted: Sun Mar 17, 2013 11:59 pm
by WilliamL
Interesting, could be useful for my needs.

It appears that you must make a second tool using the trigger After Create Executable for the new plist to be saved (Info.plist). (see below)

I have the example working and I'm trying to figure out how to put the info I use into your syntax. I will try these and correct them as needed.

For example: (I'm not sure what this is and if it is needed any more)
<key>CFBundleSignature</key>
<string>BOOK</string>

would be ;@@ CFBundleSignature = BOOK

sets the app icon
<key>CFBundleIconFile</key>
<string>BooksIcon.icns</string>

would be ;@@ CFBundleIconFile = BooksIcon.icns

sets file click to run by extension
<key>CFBundleTypeExtensions</key>
<array>
<string>BKS</string>
</array>
; see below for arrays
would be ;@@ CFBundleTypeExtensions = BKS

sets the extensions above to use this icon
<key>CFBundleTypeIconFile</key>
<string>BFileIcon.icns</string>

would be ;@@ CFBundleTypeIconFile = BFileIcon.icns

Re: plistTool for OS X

Posted: Mon Mar 18, 2013 7:10 am
by wilbert
A second tool is required if you want to create an executable (After Create Executable).
Otherwise it will only work if you use the Compile or Run commands.

<key>CFBundleSignature</key>
<string>BOOK</string>

would become
;@@ CFBundleSignature = BOOK

Setting an array is currently not supported.
It's not difficult to add, I just don't know what the best way would be to set it.

Re: plistTool for OS X

Posted: Mon Mar 18, 2013 5:43 pm
by WilliamL
I looked at my old plist and I don't see any quotes there so I will take them out of my examples above. I suppose it will take a while for the system to see the changes for them to take effect.

Re: plistTool for OS X

Posted: Fri Mar 22, 2013 7:37 am
by wilbert
@William, setting an array is supported now by plistTool 1.1
When you have to set something other than a string, you can use XML notation now.
So
<key>CFBundleTypeExtensions</key>
<array>
<string>BKS</string>
</array>

would become
;@@ <key>CFBundleTypeExtensions</key>
;@@ <array>
;@@ <string>BKS</string>
;@@ </array>

Re: plistTool for OS X

Posted: Fri Mar 22, 2013 5:17 pm
by WilliamL
ok, like

;@@ <key>CFBundleTypeExtensions</key>
;@@ <array>
;@@ <string>BKS</string>
;@@ <string>INV</string>
;@@ <string>AUT</string>
;@@ </array>


I seems that type extensions can be any length. I tried a longer extension of .PChart and it worked fine.

Re: plistTool for OS X

Posted: Fri Mar 22, 2013 5:39 pm
by wilbert
WilliamL wrote:I seems that type extensions can be any length. I tried a longer extension of .PChart and it worked fine.
Yes, that's correct.
What it actually does is load the Info.plist file PureBasic generates, merge the information you set into this and write the result back.

Re: plistTool for OS X

Posted: Tue May 14, 2013 5:38 pm
by WilliamL
Hi wilbert,

I wanted to have the Finder's to show the version number of my program and this seemed to work. I hope this is the correct place. Oh, it took a while for the Finder to show the data (moved app out of then back into it's folder to force the Finder to update).

;@@ CFBundleShortVersionString = 6.3

You need to put the link to this thread (plistTool for OS X) in the Mac forum!

Re: plistTool for OS X

Posted: Tue May 14, 2013 6:09 pm
by J. Baker
WilliamL wrote:Hi wilbert,

I wanted to have the Finder's to show the version number of my program and this seemed to work. I hope this is the correct place. Oh, it took a while for the Finder to show the data (moved app out of then back into it's folder to force the Finder to update).

;@@ CFBundleShortVersionString = 6.3

You need to put the link to this thread (plistTool for OS X) in the Mac forum!
Don't forget the copyright info. ;)
;@@ NSHumanReadableCopyright = Copyright © 2013 MyCompany. All rights reserved.

Re: plistTool for OS X

Posted: Sun Apr 06, 2014 1:49 pm
by jamirokwai
Hi all,

if you add the UPX-packing-thing from here: http://www.purebasic.fr/english/viewtop ... 19&t=50521, this would be a great enhancement :-)

Re: plistTool for OS X

Posted: Sun Apr 27, 2014 9:22 am
by thinkitsimple
Tried this helpful tool, but can't get my info.plist for my compiled executable.

I installed the tool, added the 2 tool-entries within the ide and put some plist-code into my source:

Code: Select all

;plist Info
;@@ <key>LSApplicationCategoryType</key>
;@@ <string>public.app-category.adventure-game</string>
;@@ <key>CFBundleDevelopmentRegion</key>
;@@ <string>English</string>
;@@ <key>CFBundleExecutable</key>
;@@ <string>Dungeon!</string>
;@@ <key>CFBundleGetInfoString</key>
;@@ <string>Dungeon! 1.0, Copyright © 2014 Michael Bzdega. Alle Rechte vorbehalten.</string>
;@@ <key>CFBundleIdentifier</key>
;@@ <string>com.bzdega.dungeon</string>
;@@ <key>CFBundleName</key>
;@@ <string>Dungeon!</string>
;@@ <key>CFBundleShortVersionString</key>
;@@ <string>1.0.0</string>
After creating the executable, the plist tool debug window opens, but none of the information is in there.

Is this still working with OS X 10.9.2?

Re: plistTool for OS X

Posted: Mon Apr 28, 2014 4:22 am
by J. Baker
Write it like this and notice the "NSHumanReadableCopyright". I use spaces as it's easier to read but it's not required.

Code: Select all

;@@ LSApplicationCategoryType = public.app-category.adventure-game

;@@ CFBundleDevelopmentRegion = English

;@@ CFBundleExecutable = Dungeon!

;@@ NSHumanReadableCopyright = Dungeon! 1.0, Copyright © 2014 Michael Bzdega. Alle Rechte vorbehalten.

;@@ CFBundleIdentifier = com.bzdega.dungeon

;@@ CFBundleName = Dungeon!

;@@ CFBundleShortVersionString = 1.0.0

Re: plistTool for OS X

Posted: Sun May 04, 2014 5:04 pm
by Wolfram
How can I write this with the plistTool for OS X?
;@@ <dict> </dict> dose not work.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pb</string>
<string>pbi</string>
<string>pbp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>FileIcon.icns</string>
<key>CFBundleTypeName</key>
<string>PureBasic Sourcecode</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>

Re: plistTool for OS X

Posted: Sun Aug 24, 2014 4:59 pm
by Wolfram
Is there a way to put the Code for the plistTool in a .pbi file and load this pbi in the main.pb ?

I tried

Code: Select all

IncludeFile("OSX_Info_plist.pbi")
and

Code: Select all

XIncludeFile("OSX_Info_plist.pbi")
Both doesn't work

Re: plistTool for OS X

Posted: Mon Aug 25, 2014 10:32 am
by wilbert
plistTool makes use of the tool menu.
The code it parses is passed to it with %COMPILEFILE .
I don't know if PB has the ability to pass a file with all includes resolved.