Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Combining the hints, and making it more secure' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Combining the hints, and making it more secure
Authored by: Krioni on Jan 19, '11 02:40:54PM
That removeExtension function is potentially a problem. If your file's path has a dot anywhere other than just before the file extension, the result will be very wrong.

As an example, the following:

removeExtension( "/Users/someguy/Desktop/file.with.dots.tiff" )
would return:
Even worse if there is a dot somewhere higher in the path:
removeExtension( "/Users/someguy/Documents/folder.with.dots/somefile.tiff" )
would return:
Here's a replacement:
-- remove extension
on removeExtension(in_pic)
	set {oldDelims, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "."}
	set out_pic to (text items 1 thru -2 of in_pic) as string
	set AppleScript's text item delimiters to oldDelims
	return out_pic
end removeExtension

[ Reply to This | # ]