filebookmark(
PATH
)

The filebookmark( function converts a file or folder path into a binary data value that persistently links to the file, even if it is later moved or renamed.


Parameters

This function has one parameter:

path – path to the file.


Description

This function converts a file or folder path into a binary data value that persistently links to the file, even if it is later moved (within the same volume) or renamed. If you are going to save a path permanently (in a database or file), you should use a bookmark instead of saving the text of the path. This example allows the user to choose an image with a dialog, then saves the name and location of that image in the myAvatar permanent variable.

local fileChoice
choosefileDialog fileChoice,".jpg.gif.png"
if fileChoice="" return endif
letpermanent myAvatar = filebookmark(fileChoice)

Later, the current path and name of the file can be extracted from the permanent variable by using the bookmarkpath( function. This will work even if the file has been moved or renamed since the user chose the file (of course it will return an error if the file has been deleted or moved to another volume or drive).

let avatarImagePath = bookmarkpath(myAvatar)

See Also


History

VersionStatusNotes
10.2NewNew in this version.