I want to copy the owner from one file to another.
Code: Select all
filemanager = CocoaMessage(0, CocoaMessage(0, 0, "NSFileManager alloc"), "init")
filePath_A$ = "/anyfile.txt"
object =CocoaMessage(0, filemanager, "attributesOfItemAtPath:$", @filePath$, "error:", 0)
x =CocoaMessage(0, object, "fileSize")
Debug "file size " +PeekL(@x)
x =CocoaMessage(0, object, "fileOwnerAccountName")
owner.s =PeekS(CocoaMessage(0, x, "UTF8String"), -1, #PB_UTF8)
Debug "owner " +owner
filePath_B$ = "/anotherFile.txt"
;here is the problem
attr =CocoaMessage(0, object, "NSDictionary dictionaryWithObjectsAndKeys:", x, "NSFileOwnerAccountName", 0)
CocoaMessage(0, CocoaMessage(0, 0, "NSFileManager defaultManager"), "setAttributes:", attr, "ofItemAtPath:$", @filePath_B$, "error:", 0)