folder that opens an app

[quote=79153:@Paul Baka]ok, got it to work with the above code and i just gave the package a file extension from my filetypes and wola.
thanks heaps guys.[/quote]
Päul, care to explain how you got it to work ?

It doesn’t work wtih 64bit compilation…

This thread is awfully long, what do you mean by “It doesn’t work wtih 64bit compilation…”
We can’t really help you from that.

Personally, I’d start a new thread, and provide as much detail as possible.

createaspackage function returns
an error…

[code]Sub CreateAsPackage(extends f As FolderItem) As Boolean
const kHasBundle = &h2000
f.CreateAsFolder
dim fl as integer = f.GetFolderFlagsMBS <—maybe this is the issue

if fl < 0 then
fl = kHasBundle
else
fl = BitwiseOr(fl, kHasBundle)
end if

dim e as integer = f.SetFolderFlagsMBS(fl) <—maybe this is the issue

if e = 0 then
Return True
else
Return False
end if

end Sub [/code]

An exception of class UnsupportedOperationException was not handled. The application must shut down.
Exception Message: Not implemented

You’d be best off to just do as Apple suggests on
https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html
and create a folder that has a name that is identified as being a bundle / package and skip the package bit
How the System Identifies Bundles and Packages
[i]The Finder considers a directory to be a package if any of the following conditions are true:

The directory has a known filename extension: .app, .bundle, .framework, .plugin, .kext, and so on.
The directory has an extension that some other application claims represents a package type; see Document Packages.
The directory has its package bit set.[/i]
The preferred way to specify a package is to give the package directory a known filename extension. [i]For the most part, Xcode takes care of this for you by providing templates that apply the correct extension. All you have to do is create an Xcode project of the appropriate type.

Most bundles are also packages. For example, applications and plug-ins are typically presented as a single file by the Finder. However, this is not true for all bundle types. In particular, a framework is a type of bundle that is treated as a single unit for the purposes of linking and runtime usage, but framework directories are transparent so that developers can view the header files and other resources they contain.
[/i]

basically you create a UTI and add one key to the Info.plist
https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/DocumentPackages/DocumentPackages.html#//apple_ref/doc/uid/10000123i-CH106-SW1

Registering Your Document Type

To register a document as a package, you must modify the document type information in your application’s information property list (Info.plist) file. The CFBundleDocumentTypes key stores information about the document types your application supports.
For each document package type, include the LSTypeIsPackage key with an appropriate value. [i]The presence of this key tells the Finder and Launch Services to treat directories with the given file extension as a package. For more information about Info.plist keys, see Information Property List Key Reference.

Document packages should always have an extension to identify them—even though that extension may be hidden by the user. The extension allows the Finder to identify your document directory and treat it as a package. You should never associate a document package with a MIME type or 4-byte OS type.[/i]

SetFolderFlagsMBS/GetFolderFlagsMBS uses old APIs from Mac OS Classic area.
They are old and maybe I can find you a replacement tomorrow.

Create a document UTI
Set the LSTypeIsPackage item in the registered UTI = true

I added the newer package functions:

Set:

[code]Dim f As FolderItem = SpecialFolder.Desktop.Child(“test”)
Dim c As CFURLMBS = NewCFURLMBSFile(f)

Dim e As CFErrorMBS

If c.SetResourcePropertyForKey(c.kCFURLIsPackageKey, NewCFBooleanMBS(true), e) Then
MsgBox “OK”
Else
MsgBox "Error: "+e.Description
End If[/code]

Query:

[code]Dim f As FolderItem = SpecialFolder.Desktop.Child(“test”)
Dim c As CFURLMBS = NewCFURLMBSFile(f)

Dim v As Variant
Dim e As CFErrorMBS

If c.ResourcePropertyForKey(c.kCFURLIsPackageKey, v, e) Then
Dim p As CFBooleanMBS = v

MsgBox "IsPackage: "+Str(p.Value)
Else
MsgBox "Error: "+e.Description
End If[/code]

newer plugin:
https://www.dropbox.com/sh/ed3ibt7muhmrri4/AADbZ6i-Fq_JJzilvlML_GKNa?dl=0
or later in pr4.