Re: Finder - getting file type
Re: Finder - getting file type
- Subject: Re: Finder - getting file type
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 23 Dec 2004 01:15:51 -0800
Title: Re: Finder - getting file type
On 12/23/04 1:02 AM, "DizzyPenguin" <email@hidden> wrote:
set existFile_wExt to (fullPath as Unicode text & coverName & ".jpg")
tell application "Finder" to set fType to (file type of alias existFile_wExt)
Isn't it safer to have the "as Unicode text" at the end, in case the coverName variable contains accented characters (here I go again with those!)?
No. The concatenation operator ('&') implicitly coerces the class of operand(s) on its right to the class of the leftmost operand. If you've already erroneously used string for coverName when you should have used Unicode it will be too late anyhow. If it's already Unicode, good: coercing fullPath to Unicode (if necessary) will preserve the Unicode of coverName and keep it Unicode when concatenating ".jpg" string to the end. Whereas if fullPath were string and then you concatenated coverName to it it would all change to string first and you'd lose the Unicode. It would make no difference that you then converted the resulting long string back to Unicode at the end - the characters would just be "Unicode versions' of the string characters, NOT the original Unicode. Of course, if fullPath is the path to a folder it should be in Unicode to begin with. If so, you don't need 'as Unicode text' at all. The first item fullPath is Unicode, the coverName hopefully is Unicode which will be preserved, and the whole thing including ".jpg" will be Unicode, with no need for explicit coercion at all.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden