PureBasic Forum
https://www.purebasic.fr/english/

plistTool for OS X
https://www.purebasic.fr/english/viewtopic.php?f=27&t=53905
Page 1 of 2

Author:  wilbert [ Tue Mar 12, 2013 9:15 am ]
Post subject:  plistTool for OS X

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:
;@@ 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:
;@@ <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

Author:  WilliamL [ Sun Mar 17, 2013 11:59 pm ]
Post subject:  Re: plistTool for OS X

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

Author:  wilbert [ Mon Mar 18, 2013 7:10 am ]
Post subject:  Re: plistTool for OS X

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.

Author:  WilliamL [ Mon Mar 18, 2013 5:43 pm ]
Post subject:  Re: plistTool for OS X

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.

Author:  wilbert [ Fri Mar 22, 2013 7:37 am ]
Post subject:  Re: plistTool for OS X

@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>

Author:  WilliamL [ Fri Mar 22, 2013 5:17 pm ]
Post subject:  Re: plistTool for OS X

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.

Author:  wilbert [ Fri Mar 22, 2013 5:39 pm ]
Post subject:  Re: plistTool for OS X

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.

Author:  WilliamL [ Tue May 14, 2013 5:38 pm ]
Post subject:  Re: plistTool for OS X

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!

Author:  J. Baker [ Tue May 14, 2013 6:09 pm ]
Post subject:  Re: plistTool for OS X

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.

Author:  jamirokwai [ Sun Apr 06, 2014 1:49 pm ]
Post subject:  Re: plistTool for OS X

Hi all,

if you add the UPX-packing-thing from here: viewtopic.php?f=19&t=50521, this would be a great enhancement :-)

Author:  thinkitsimple [ Sun Apr 27, 2014 9:22 am ]
Post subject:  Re: plistTool for OS X

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:
;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?

Author:  J. Baker [ Mon Apr 28, 2014 4:22 am ]
Post subject:  Re: plistTool for OS X

Write it like this and notice the "NSHumanReadableCopyright". I use spaces as it's easier to read but it's not required.
Code:
;@@ 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

Author:  Wolfram [ Sun May 04, 2014 5:04 pm ]
Post subject:  Re: plistTool for OS X

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>

Author:  Wolfram [ Sun Aug 24, 2014 4:59 pm ]
Post subject:  Re: plistTool for OS X

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:
IncludeFile("OSX_Info_plist.pbi")
and
Code:
XIncludeFile("OSX_Info_plist.pbi")


Both doesn't work

Author:  wilbert [ Mon Aug 25, 2014 10:32 am ]
Post subject:  Re: plistTool for OS X

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.

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/