news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

FL_NameFromPath

Revision 1
Revised on 18/03/95 12:50

Description

Return the name of a file. Takes the full pathname of the file.

If passed a folder path (with or without a colon on the end), it returns the name of the folder.

Note that this routine doesn't check to see whether the file/folder exists or whether the path is legal.


Code

function FL_NameFromPath path
  -- given the path to a file, returns just the filename
  
  -- remove final colon if its a folder
  if last char of path is colon then
    delete last char of path
  end if
  
  -- return everything after last colon
  get the itemDelimiter
  set the itemDelimiter to colon
  put last item of path into name
  set the itemDelimiter to it
  return name
end FL_NameFromPath