file.exists & aliases

Sean Elfstrom selfstro at imagiq.com
Tue Sep 18 18:28:28 PDT 2001


At 8:32 AM -0400 9/18/01, Ken Dow wrote:
>On my Mac OS X machine, file.exists returns false if there is an alias in the path. For example, in this path:
>
>	Buffy:Applications (Mac OS X):Frontier:www:system:upstream:Private Sites:distributor
>
>Private Sites is an alias to a folder. If I enter that path into the Finder's Go command, it is correctly resolved and the distributor folder is displayed. But
>
>	file.exists("Buffy:Applications (Mac OS X):Radio UserLand:www:system:upstream:Private Sites:distributor")
>
>Returns false. Is this expected? Does it work the same way with shortcuts on Windows? TIA.

I don't think many (if any) of the file.* verbs resolve aliases in the whole path. You use something similar to this:

on exists (path, resolveAliases=false) {
	if resolveAliases {
		local (ct = string.countFields (path, ":"));
		local (ix);
		local (resolvedPath="");
		local (temp="");
		for ix = 1 to ct {
			temp = resolvedPath + string.nthField (path, ":", ix) + ":";
			if file.exists (temp) {
				resolvedPath =  file.resolveAlias (temp);
				if not resolvedPath {
					return (false)}}
			else {
				return (false)}};
		if !file.isFolder (resolvedPath) {
			resolvedPath = string.popTrailing (resolvedPath, ":")};
		return (true)}
	else {
		file.exists (path)}}
-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Sean Elfstrom      selfstro at ImagiQ.com | ImagiQ    http://www.ImagiQ.com/
XO/Mac Wrangler         PGP:0x716F29D6 | 2325 NW Military, Suite 103
Apple Product Professional          O- | San Antonio, TX 78231
Apple Authorized Sales & Service       | 210-377-3545        800-750-0787





More information about the Frontier-Users mailing list