Hi Shane,
I started a new project with the following code:
script AppDelegate
property parent : class "NSObject"
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
on testRemoveAtPath_(sender)
set overwiteItem to true
set src to "/Users/kader/Desktop/Test Hotfolder/OUT/TESTCOPY.JPG"
set dst to "/Users/kader/Desktop/Test Hotfolder/OUT/TESTCOPY2.JPG"
set localFileManager to (current application's NSFileManager's defaultManager())
set itemExists to localFileManager's fileExistsAtPath_(dst)
if itemExists as boolean
if overwiteItem
set theresult to localFileManager's removeItemAtPath_error_(dst, reference)
log theresult
set theresult to localFileManager's copyItemAtPath_toPath_error_(src, dst, reference)
log theresult
else
-- leave as is
log "leave as is"
end
else
-- copy file to dst
log "copy file"
set theresult to localFileManager's copyItemAtPath_toPath_error_(src, dst, reference)
log theresult
end
end
end script
I now suspect that the copyItemAtPath_toPath_error_ method is the problem.
If I comment these lines out then the code runs OK otherwise it crashes.
Here is the crash log :
CoreFoundation`CFRetain:
0x7fff904ea080: pushq %rbp
0x7fff904ea081: movq %rsp, %rbp
0x7fff904ea084: pushq %rbx
0x7fff904ea085: pushq %rax
0x7fff904ea086: movq %rdi, %rbx
0x7fff904ea089: testq %rbx, %rbx
0x7fff904ea08c: jne 0x7fff904ea0ae ; CFRetain + 46
0x7fff904ea08e: leaq 1620375(%rip), %rax ; "*** CFRetain() called with NULL ***"
0x7fff904ea095: movq %rax, 2285484(%rip) ; kd_block_encoder::encode(kdu_block*, bool, double, unsigned short) + 5612
0x7fff904ea09c: int3
0x7fff904ea09d: callq 0x7fff90663930 ; symbol stub for: getpid
0x7fff904ea0a2: movl %eax, %edi
0x7fff904ea0a4: movl $9, %esi
0x7fff904ea0a9: callq 0x7fff90663984 ; symbol stub for: kill
0x7fff904ea0ae: testb $1, %bl
0x7fff904ea0b1: jne 0x7fff904ea101 ; CFRetain + 129
0x7fff904ea0b3: movl 8(%rbx), %eax
0x7fff904ea0b6: shrl $8, %eax
0x7fff904ea0b9: andl $1023, %eax
0x7fff904ea0be: movq (%rbx), %rcx
0x7fff904ea0c1: testq %rcx, %rcx
0x7fff904ea0c4: je 0x7fff904ea124 ; CFRetain + 164
0x7fff904ea0c6: cmpq 2309995(%rip), %rcx ; kd_create_dwt_description(int, int, kdu_params*, int, bool&, bool&, bool&, int&, kdu_kernel_step_info*&, float*&) + 1399
0x7fff904ea0cd: je 0x7fff904ea124 ; CFRetain + 164
0x7fff904ea0cf: leaq 2301786(%rip), %rdx ; kd_block::retrieve_data(kdu_block*, int) + 542
0x7fff904ea0d6: cmpq (%rdx,%rax,8), %rcx
0x7fff904ea0da: je 0x7fff904ea124 ; CFRetain + 164
0x7fff904ea0dc: movq 2309965(%rip), %rax ; kd_create_dwt_description(int, int, kdu_params*, int, bool&, bool&, bool&, int&, kdu_kernel_step_info*&, float*&) + 1391
0x7fff904ea0e3: testq %rax, %rax
0x7fff904ea0e6: je 0x7fff904ea10b ; CFRetain + 139
0x7fff904ea0e8: movq %rbx, %rdi
0x7fff904ea0eb: callq *%rax
0x7fff904ea0ed: cmpb $1, %al
0x7fff904ea0ef: jne 0x7fff904ea10b ; CFRetain + 139
0x7fff904ea0f1: callq 0x7fff90663438 ; symbol stub for: objc_collectableZone
0x7fff904ea0f6: movq %rax, %rdi
0x7fff904ea0f9: movq %rbx, %rsi
0x7fff904ea0fc: callq 0x7fff90662f76 ; symbol stub for: auto_zone_retain
0x7fff904ea101: movq %rbx, %rax
0x7fff904ea104: addq $8, %rsp
0x7fff904ea108: popq %rbx
0x7fff904ea109: popq %rbp
0x7fff904ea10a: ret
0x7fff904ea10b: movq 2086174(%rip), %rax ; Librarian.__TEXT.__eh_frame + 9744
0x7fff904ea112: leaq 2086167(%rip), %rsi ; Librarian.__TEXT.__eh_frame + 9744
0x7fff904ea119: movq %rbx, %rdi
0x7fff904ea11c: addq $8, %rsp
0x7fff904ea120: popq %rbx
0x7fff904ea121: popq %rbp
0x7fff904ea122: jmpq *%rax
0x7fff904ea124: movq %rbx, %rdi
0x7fff904ea127: xorl %esi, %esi
0x7fff904ea129: addq $8, %rsp
0x7fff904ea12d: popq %rbx
0x7fff904ea12e: popq %rbp
0x7fff904ea12f: jmpq 0x7fff904ea140 ; _CFRetain
0x7fff904ea134: nopw %cs:(%rax,%rax)
I hope you can find something useful.
Thanks for the efforts.
Model: macbook Pro
Browser: Safari 536.25
Operating System: Mac OS X (10.8)