Is a file an alias?

Martin Baxter mb.userev at harbourhosting.co.uk
Mon May 5 16:00:17 EDT 2008


For Windows, I should think you could just test for testalias empty? If
it had a path in it at all, that would indicate that somefile was an alias.

Linux I can't check.

Martin

David Bovill wrote:
> How about:
> 
> function file_IsAlias someFile
>     put the aliasreference of someFile into testAlias
>     return someFile is not testAlias or testAlias is empty
> end file_IsAlias
> 
> Any problems with that - how does it work on Linux?
> 
> 
> 2008/5/5 Martin Baxter <mb.userev at harbourhosting.co.uk>:
> 
>> 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