[futurebasic] FileContentsEqual

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2010 : Group Archive : Group : All Groups

From: Bernie <fblist.bw@...>
Date: Sat, 13 Nov 2010 09:37:07 +0000
Don't know how we do it in Carbon, but this wrapper compares the contents of any two files (including apps). 
'---------------
// substitute your own paths
// compile as Ojbective-C

include "ConsoleWindow"

BeginCFunction
Boolean FileContentsEqual( CFStringRef path1, CFStringRef path2 )
{
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     BOOL flag = [[NSFileManager defaultManager] contentsEqualAtPath:(NSString *)path1 andPath:(NSString *)path2];
     [pool drain];
     return flag;
}
EndC
toolbox fn FileContentsEqual( CFStringRef path1, CFStringRef path2 ) = Boolean

print fn FileContentsEqual( @"Test.bas", @"MyBackups/Test.bas" )
'---------------