Shane-
Thanks for the tip. I tried the recommended NSError method with parentheses:
on renamePathAndLog(sourcePath, destPath, destName)
set {theRenamed, theError} to fileManager's moveItemAtPath_toPath_error_(sourcePath, destPath, reference)
if not (theRenamed as boolean) then
set theErrorString to theError's localizedDescription() as string
return {false, theErrorString}
else
return {true, destPath}
end if
end renamePathAndLog
but my application continues to crash at runtime. Below is what I get in the crash log. I don’t know if anyone might be able to steer me in the right direction, but the crash has something to do with trying to trap this error. If I just return the boolean and pass missing value for the error parameter, the app works, I just can’t get the specific error (not the end of the world), but passing ‘reference’ and trying to parse out something from the NSError object causing my app crashes.
Here’s a chunk of the crash report:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x00007fff8ace3ae3 CFRetain + 51
1 com.apple.AppleScriptObjC 0x00007fff8dd68574 specifierForObjCInstance + 120
2 com.apple.AppleScriptObjC 0x00007fff8dd680f2 descriptorForData + 350
3 com.apple.AppleScriptObjC 0x00007fff8dd6a0fb -[NSInvocation(AppleScriptObjC) returnValueAsDescriptor] + 472
4 com.apple.AppleScriptObjC 0x00007fff8dd6c645 Invoke + 2026
5 com.apple.AppleScriptObjC 0x00007fff8dd6d372 BASendProc + 2241
6 com.apple.applescript 0x000000010a9c5323 ComponentSend(AEDesc const*, AEDesc*, int, int) + 510
7 com.apple.applescript 0x000000010a9d3fcd TUASApplication::Send(TStackFrame_UASRemoteSend*, AEDesc*, AEDesc*, unsigned char, unsigned char, unsigned char) + 2565
8 com.apple.applescript 0x000000010a9efee2 UASRemoteSend(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char*) + 432
9 com.apple.applescript 0x000000010a9d84ba UASExecute1() + 369
10 com.apple.applescript 0x000000010a9b1495 ASExecuteEvent(AEDesc const*, unsigned int, int, unsigned int*) + 848
11 com.apple.applescript 0x000000010a9aa33a AppleScriptComponent + 1778
12 com.apple.openscripting 0x00007fff937280d0 OSAExecuteEvent + 66
13 com.apple.AppleScriptObjC 0x00007fff8dd660a2 +[BAObjectProto invokeScriptHandler:forObject:args:error:] + 249
14 com.apple.AppleScriptObjC 0x00007fff8dd670bc -[BAObjectProto forwardInvocation:] + 347
15 com.apple.CoreFoundation 0x00007fff8ad63197 forwarding + 775
16 com.apple.CoreFoundation 0x00007fff8ad62e18 _CF_forwarding_prep_0 + 232
17 com.apple.AppKit 0x00007fff92b6c959 -[NSApplication sendAction:to:from:] + 342
18 com.apple.AppKit 0x00007fff92b6c7b7 -[NSControl sendAction:to:] + 85
19 com.apple.AppKit 0x00007fff92b6c6eb -[NSCell _sendActionFrom:] + 138
20 com.apple.AppKit 0x00007fff92b6abd3 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 1855
21 com.apple.AppKit 0x00007fff92b6a421 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 504
22 com.apple.AppKit 0x00007fff92b69b9c -[NSControl mouseDown:] + 820
23 com.apple.AppKit 0x00007fff92b6150e -[NSWindow sendEvent:] + 6853
24 com.apple.AppKit 0x00007fff92b5d644 -[NSApplication sendEvent:] + 5761
25 com.apple.AppKit 0x00007fff92a7321a -[NSApplication run] + 636
26 com.apple.AppKit 0x00007fff92a17bd6 NSApplicationMain + 869
27 libdyld.dylib 0x00007fff8b8197e1 start + 1