FolderItem.SaveInfo
From Xojo Documentation
Method
FolderItem.SaveInfo(RelativeTo as FolderItem, SaveInfoMode as FolderItem.SaveInfoModes) As MemoryBlock
New in 2019r2
Supported for all project types and targets.
New in 2019r2
Supported for all project types and targets.
Allows saving FolderItem references without relying on the absolute path.
Notes
The returned MemoryBlock indicates a path which is relative to the supplied RelativeTo folder. You may pass Nil to indicate that you do not care for a relative resolution of the path (this is, for instance, still useful on macOS where renamed and moved files can still be found with the FolderItem.FromSaveInfo function nonetheless).
The returned MemoryBlock is not intended to be human-readable and any modifications may render it useless. |
Example
Shows how a SaveInfo MemoryBlock can be used with FromSaveInfo to open a file and show its path:
Var f, g As FolderItem
f = New FolderItem
g = f.FromSaveInfo(f.SaveInfo(Volume(0).Child("Documents"), FolderItem.SaveInfoModes.Default))
If g <> Nil Then
TextField1.Value = g.NativePath
Else
MessageBox("FolderItem does not exist!")
End If
f = New FolderItem
g = f.FromSaveInfo(f.SaveInfo(Volume(0).Child("Documents"), FolderItem.SaveInfoModes.Default))
If g <> Nil Then
TextField1.Value = g.NativePath
Else
MessageBox("FolderItem does not exist!")
End If
You can also use GetFolderItem with a SaveInfo MemoryBlock:
Var info As MemoryBlock // Assign a saveInfo memoryblock from a previously accessed file
Var f As FolderItem
f = New FolderItem(info, FolderItem.PathModes.Native)
Var f As FolderItem
f = New FolderItem(info, FolderItem.PathModes.Native)