Is a file an alias?
Martin Baxter
mb.userev at harbourhosting.co.uk
Mon May 5 13:11:56 EDT 2008
David Bovill wrote:
> I guess this works? Can someone test it on windows?
>
> function file_IsAlias someFile
>> put the aliasreference of someFile into testAlias
>> return someFile is not testAlias
>> end file_IsAlias
>>
>
> 2008/5/5 David Bovill <david at openpartnership.net>:
>
>> Is there a way to find out if a file is an alias. The only way I can do it
>> at the moment is with MacOS specific hacks?
>>
If the file in question is *not* an alias (aka a shortcut on Windows)
the aliasreference returns empty here on XP. So I would expect the above
function to always report that someFile <> testAlias, Regardless of
whether it was one or not.
On Windows, shortcuts have the file extension ".lnk", perhaps all you
need to do is check for that?
A quick test shows this works on my system:
answer file "whatever"
put it into vv
if vv is not empty then
set itemdelimiter to "."
if last item of vv = "lnk" then
put "Is a shortcut"
else
put "is not a shortcut"
end if
end if
Martin Baxter
--
I am Not a Number, I am a free NaN
More information about the use-livecode
mailing list