[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 16:47:27 +0100
rc wrote:

> 
> Same code, different need…I need to filter the files…but the dang thing doesn't like the variable itemUTI, and I'm getting one from sitting in this chair now.
> 
> How the heck can I get the dang things to 'cross talk'? And then be able to print things out for confirmation with: fn ConsolePrintCFString(()?
> 
> Local Fn FileFilter(filterType as short, itemURL as CFURLRef)
> dim as short result
> result = _false
> 
> beginCCode
> NSString* itemUTI; // ID or whatever
> [(NSURL *)itemURL getResourceValue:&itemUTI forKey:NSURLTypeIdentifierKey error:nil];
> endC
> 
> if fn UTTypeConformsTo( itemUTI, kUTTypeJPEG  ) then result = _true: exit fn
> 
> if result = _True then stop "Got JPEG"
> 
> end fn = result
> --


'---------------
compile as "Objective-C"
include "ConsoleWindow"

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

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

dim as CFURLRef url

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