About Elegant Chaos
About me and my friends
Software from Elegant Chaos
Other stuff...


Revision 1
Revised on 18/03/95 19:02


Rename a stack, leaving it in the same folder. Takes the name or full path of the stack, and and a new name for it. Returns true if the renaming was succesful, false if there is already a stack of that name.

To be certain that you're renaming the right stack, pass the full path of it. If just the current name is specified for the stack, Hypercard will rename the first stack it finds with that name, which might not be the one you had in mind!

Note that the stack is only renamed, it isn't moved to a different folder.


function FL_RenameStack oldPath, newName
  -- rename a stack (but keep it in the same folder)
  -- set up default result
  put false into theResult
  -- get full path of new stack
  put FL_StackFolder(oldPath) & newName into newPath
  -- check that there isn't already a stack with the new name
  if there is a stack oldPath then
    if there is not a stack newPath then
      -- do the renaming
      put the cantModify of stack oldPath into oldmod
      set the cantModify of stack oldPath to false
      set the name of stack oldPath to newName
      set the cantModify of stack newPath to oldmod
      put true into theResult
    end if
  end if
  -- return result saying whether renaming was succesful
  return theResult
end FL_RenameStack