Saving "Bundle-Type" Documents
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 92
- Joined: Wed May 29, 2013 1:54 am
- Location: Sydney, Australia
Saving "Bundle-Type" Documents
Is it possible to have my LiveCode (MacOS desktop) app save a document as a 'bundle'?
AFAIK, bundles are just directories, but there must be something special that needs to be done so that the system recognises the directory as a 'bundle file', rather than as a simple directory. Is this something possible to do with LiveCode?
Many thanks in advance for any guidance.
AFAIK, bundles are just directories, but there must be something special that needs to be done so that the system recognises the directory as a 'bundle file', rather than as a simple directory. Is this something possible to do with LiveCode?
Many thanks in advance for any guidance.
Re: Saving "Bundle-Type" Documents
Hi Igor,
just add the extension ".bundle" to your folder and that's it!
No idea how to make it work with other suffixes.
Best
Klaus
just add the extension ".bundle" to your folder and that's it!
No idea how to make it work with other suffixes.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: Saving "Bundle-Type" Documents
For a full description of the ways of doing this...https://developer.apple.com/library/mac ... -CH106-SW1
James
James
-
- Posts: 845
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Saving "Bundle-Type" Documents
Hi,
Like the original poster I want to hide my data files inside a folder that appears to the Mac OS Finder as an application folder. I have managed to get part way :
1) When building the standalone I allowed Livecode (well Revolution!) write the PList file with a name for my application "BankManager", a document type of "bmbm" and an extension of "bmb". Note the extension should be unique and I think it can be more than three characters.
2) Build the application.
3) Open the application package and open the pList file in a text editor.
4) Seek the following portion and add the two new keys and values shown at the end of the snip just before the </dict>:
I only managed to get it to work once the NSDocumentClass was added, adding just the LSTypeIsPackage did not work. Next I will try and set some icons.
5) Create a new folder using the Finder or your app and give it the extension you have defined i.e. "bmb" in the example above. You should see the icon change and be given the option to "show package contents" when you right click on the icon.
Like the original poster I want to hide my data files inside a folder that appears to the Mac OS Finder as an application folder. I have managed to get part way :
1) When building the standalone I allowed Livecode (well Revolution!) write the PList file with a name for my application "BankManager", a document type of "bmbm" and an extension of "bmb". Note the extension should be unique and I think it can be more than three characters.
2) Build the application.
3) Open the application package and open the pList file in a text editor.
4) Seek the following portion and add the two new keys and values shown at the end of the snip just before the </dict>:
Code: Select all
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>bmb</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>StandaloneDoc.icns</string>
<key>CFBundleTypeName</key>
<string>BankManager Files</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>bmbm</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>Document</string>
<key>LSTypeIsPackage</key>
<true/>
</dict>
5) Create a new folder using the Finder or your app and give it the extension you have defined i.e. "bmb" in the example above. You should see the icon change and be given the option to "show package contents" when you right click on the icon.
best wishes
Skids
Skids
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Saving "Bundle-Type" Documents
It may be helpful to keep in mind that stack files can also be used as documents, and being stacks they can contain nearly any data and objects your users may need to store. This would give you tremendous flexibility for a wide range of both disparate media types and rich hierarchical data storage (through custom property sets), and keep your options wide open for consistent deployment to other platforms.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 845
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Saving "Bundle-Type" Documents
I would like to try and use a stack as a data stack as you suggest but am uncertain how to proceed. Would a simple design use a standard application stack to hold the program logic and have code that uses the "create stack" command to create a stack file to store data and objects?
best wishes
Skids
Skids
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Saving "Bundle-Type" Documents
Yep. When first created, a stack has no file name - much like unsaved documents in any app. You can use the "ask file" command to let the user save it, assigning the path returned from that command to the stack's filename property, and then using the "save" command to write it to disk.Simon Knight wrote:Would a simple design use a standard application stack to hold the program logic and have code that uses the "create stack" command to create a stack file to store data and objects?
You could conceivably use the same stack for both the user's data and for displaying that data, but I generally try to avoid that. For viewing the data I make a stack in the app named something like "DocTMPL" (easily distinguished in my stack like in the App Browser as the document template), and use the clone command each time I need a copy during the session. But for the data that gets displayed there I often use a plain stack file, named at creation with something arbitrary like UUID, and maintain the relationship between that data stack and the view stack by having a custom prop in the view stack with the name of the stack where its data will be saved.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Saving "Bundle-Type" Documents
Hi,
Like the original poster I want to hide my data files inside a folder that appears to the Mac OS Finder as an application folder. I have managed to get part way :
1) When building the standalone I allowed Livecode (well Revolution!) write the PList file with a name for my application "BankManager", a document type of "bmbm" and an extension of "bmb". Note the extension should be unique and I think it can be more than three characters.
2) Build the application.
Like the original poster I want to hide my data files inside a folder that appears to the Mac OS Finder as an application folder. I have managed to get part way :
1) When building the standalone I allowed Livecode (well Revolution!) write the PList file with a name for my application "BankManager", a document type of "bmbm" and an extension of "bmb". Note the extension should be unique and I think it can be more than three characters.
2) Build the application.
hi