[futurebasic] Re: [FB] Total items count for folder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2013 : Group Archive : Group : All Groups

From: Bernie <fblist.bw@...>
Date: Thu, 27 Jun 2013 17:27:09 +0100
> dim as Boolean   result
> 
> BeginCCode
> NSString *itemUTI;
> [(NSURL *)itemURL getResourceValue:&itemUTI forKey:NSURLTypeIdentifierKey error:nil];
> result = UTTypeConformsTo( (CFStringRef)itemUTI, kUTTypeJPEG );
> EndC
> end fn = result
> 

This works too:
'---------------
compile as "Objective-C"
include "ConsoleWindow"
include "Tlbx UTType.incl"
include "Tlbx UTCoreTypes.incl"

local fn FileFilter( itemURL as CFURLRef )
'~'1
dim as CFStringRef   itemUTI
dim as Boolean       result

BeginCCode
[(NSURL *)itemURL getResourceValue:(id *)&itemUTI forKey:NSURLTypeIdentifierKey error:nil];
EndC
result = fn UTTypeConformsTo( itemUTI, kUTTypeJPEG )
end fn = result

dim as CFURLRef url

if ( files$( _CFURLRefOpen,,, @url ) )
print fn FileFilter( url )
CFRelease( url )
end if
'---------------