FolderItem.GetSaveInfo
From Xojo Documentation
This item was deprecated in version 2019r2. Please use FolderItem.SaveInfo as a replacement. |
Method
FolderItem.GetSaveInfo(RelativeTo as FolderItem, Mode as Integer) As String
New in 5.0
Supported for all project types and targets.
New in 5.0
Supported for all project types and targets.
Allows saving FolderItem references without relying on the absolute path.
Notes
The returned string 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.GetRelative function nonetheless).
The Class Constants and values for Mode are:
Class Constant | Value | Description |
---|---|---|
SaveInfoDefaultMode | 0 | The FolderItem should be open in any way that it can possibly be created. This is the default value. |
SaveInfoRelativeMode | 1 | The FolderItem should only be opened using relative path information. |
SaveInfoAbsoluteMode | 2 | The FolderItem should only be opened using absolute path information. |
The returned string is not intended to be human-readable and any modifications may render it useless. |
Example
Shows how a GetSaveInfo string can be used with GetRelative to open a file and show its path:
Dim f, g As FolderItem
f = New FolderItem
g = f.GetRelative(f.GetSaveInfo(Volume(0).Child("Documents"), FolderItem.SaveInfoDefaultMode))
If g <> Nil Then
TextField1.Text = g.NativePath
Else
MsgBox("FolderItem does not exist!")
End If
f = New FolderItem
g = f.GetRelative(f.GetSaveInfo(Volume(0).Child("Documents"), FolderItem.SaveInfoDefaultMode))
If g <> Nil Then
TextField1.Text = g.NativePath
Else
MsgBox("FolderItem does not exist!")
End If
You can also use GetFolderItem to open a GetSaveInfo string:
Dim saveInfo As String // Assign a saveInfo string from a previously accessed file
Dim f As FolderItem
f = GetFolderItem(saveInfo, FolderItem.PathTypeNative)
Dim f As FolderItem
f = GetFolderItem(saveInfo, FolderItem.PathTypeNative)