Hi all,
is it possible to create a fileRef in the Resource folder of a Application Bundle? I know I can manually place a file there and read from if but I was hoping that if the fileRef didn’t exist then I could create it?
Thanks,
Nik
Hi,
I’ve got it sorted, thanks for looking though!
try
set install_log to ((path to me) as string) & "Contents:Resources:script_install_log" as alias
on error
try
set install_date to (current date) as string
set fileRef to (open for access ((path to me) as string) & "Contents:Resources:script_install_log" with write permission)
write (install_date) to fileRef
close access fileRef
set install_log to ((path to me) as string) & "Contents:Resources:script_install_log" as alias
on error
try
close access fileRef
end try
end try
end try
My problem was that I was trying to specify a path to resource as string and it wouldn’t work so I took it back to path to me and it seems to work fine.
Thanks,
Nik
Nitpick: You’re getting an alias from path to command and then coercing it. You can use the command’s as parameter to return the desired class directly.
(path to me as Unicode text)
Hi Bruce,
You’re slowly but surely fine tuning my scripts!
Thanks,
Nik;)