Packages

Mark Smith mark at maseurope.net
Sun Dec 9 11:45:06 EST 2007


Finally, here is my attempt at a workaround:

function isPackage pFolder
     -- first check for presence of PkgInfo
     if char -1 of pFolder is "/" then delete char -1 of pFolder
     if there is a file (pFolder & "/Contents/PkgInfo") then return true

     -- if still here, then check suffix
     put "bundle,app,pages,numbers,key,band,rtfd" into suffixList --  
this needs filling out!
     repeat with n = length(pFolder) down to 1
         if char n of pFolder is "." then
             delete char 1 to n of pFolder
             exit repeat
         end if
     end repeat
     if pFolder is among the items of suffixList then return true

     -- would check the bundle bit, but don't know how!

     return false
end isPackage

function thePackages -- works like 'the files/folders' ie. you have  
to set the directory, but call with get thePackages()
     put the folders into foList
     repeat for each line L in foList
         if isPackage(L) then put L & cr after tList
     end repeat
     return char 1 to -2 of tList
end thePackages

Best,

Mark

On 9 Dec 2007, at 15:56, Mark Smith wrote:

> It's been a bit of a journey, hasn't it :) Anyway, I've added the  
> suggestion for an 'isPackage()' function to 5549.
>
> Best,
>
> Mark
>
> On 9 Dec 2007, at 15:40, Klaus Major wrote:
>
>> Hi Mark,
>>
>>> It's definitely a pain for Rev programmers until a general and  
>>> reliable isPackage() function or somesuch is available.
>>> I don't think any of the things discussed so far will give a  
>>> definitive answer as to the packageness of a folder.
>>> Checking .suffixes will work, but the list of suffixes probably  
>>> can't be exhaustive, the absence of a .DS_Store is not reliable  
>>> (a package that has been a regular folder may well have one, a  
>>> regular folder may not have one), and the presence of /Contents/ 
>>> PkgInfo or /Contents/Info.plist is also not guaranteed ( though  
>>> the only packages I've seen so far without a pkgInfo or  
>>> info.plist are .rtfd and .band ).
>>> Definitely a pain.
>>> Perhaps this should be an enhancement request in the qa centre?
>>
>> Already in there: 5549
>> Reported by me who started this thread a long time ago ;-)
>>
>>> Best,
>>>
>>> Mark
>>
>> Regards
>>
>> Klaus Major
>> klaus at major-k.de
>> http://www.major-k.de
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the Use-livecode mailing list