Newly created alias is not an alias

Alain Farmer alain_farmer at yahoo.com
Tue Sep 2 14:29:00 EDT 2014


Explaining this has made me come-up with the solution:

function isAlias pathToAlias
   return the aliasReference of pathToAlias is not pathToAlias
end isAlias

on testAliases currentFolder
   --
   put currentFolder & "test/" into targetFolder
   put currentFolder & "test-alias" into aliasPath
   --
   if there is not a folder aliasPath then -- alias of a folder is a folder
      create alias aliasPath to folder targetFolder
      if the result is not empty then answer the result
   end if
   --
   answer isAlias(aliasPath) & cr & isAlias(targetFolder) -- answers: true & cr & false
   --
end testAliases



On Tuesday, September 2, 2014 2:18:04 PM, Alain Farmer <alain_farmer at yahoo.com> wrote:
 


Thank you, Mark, but the aliasReference is NEVER empty. 

Therefore cannot use: if the aliasReference of it is empty
to test if something is an alias.:

on testAliases currentFolder

   --
   put currentFolder & "test/" into targetFolder
   put currentFolder & "test-alias" into aliasPath
   --

   if there is not a folder aliasPath then -- alias of a folder is a folder
      create alias aliasPath to folder targetFolder
      if the result is not empty then answer the result
   end if
   --
   answer aliasPath & cr & the aliasReference of aliasPath -- answers targetFolder
   answer targetFolder& cr & the aliasReference of targetFolder -- answers targetFolder -- instead of empty
   --
end testAliases



On Monday, September 1, 2014 7:29:56 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:
 


Alain Farmer <alain_farmer at ...> writes:

>    setDirectoryTo someFolder
>    create alias "myAlias" to folder "existingFolder"
>    if the result is not empty then die the result
>    answer there is an alias "myAlias" -- returns false !?!

I've never heard of a "there is an alias" reference. Instead try

create alias "myAlias" to folder "existingFolder"
if the aliasReference of "myAlias" is empty then
  die "it's not a reference!"
end if

-- 
Mark Wieder
ahsoftware at gmail.com



_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


More information about the use-livecode mailing list