Saving Folderitem details in a preferences file

Hi
I am developing an app and want to have a system setup/preferences file, which I have got no problem. (Using the very nice PreferencesModule provided by a user on this forum, thank you).

A number of the items I want to store involve saving file path locations to various things the app needs to access.

I can set up access to these in code in the app just fine using FolderItems, but I cant see how to ‘save’ a FolderItems value to a (text) prefs file and then re-assign the text in the pref file back to a FolderItem when I retrieve it from the prefs file.

I am a bit confused about the various methods of the FolderItem and cant see an obvious one to do this.

Any help be greatly appreciated.

Thank you
Mark

Save the SaveInfo and then restore that
See http://documentation.xojo.com/api/files/folderitem.html.SaveInfo

Hey Norman
Thanks for the reply. Sorry to be a bit slow but I am not getting the docs at all :frowning:
It feels that what I want is pretty straightforward and I imagine lots of apps must do this.

  1. Select a path in the app (file dialog box, select path, stored in a FolderItem)

  2. Save that path in a prefs file as text

  3. Open prefs file, read in text line that we saved above.

  4. Set a FolderItem to that text value from prefs file.

Sorry but I am just not seeing how to do this from the docs. I have stared at them for ages and it isnt coming…

Could anybody help further pls??
Many thanks
Mark

yeah in general I would NOT save paths

paths a re “fixed locations” and people can/may move files and, at least on macOS, it can deal with that

thats the point of the SaveInfo

it gives you a “blob” of data that, if you save it appropriately (say hex encode it etc), can be restored and the file that it originally referred to will still be referred to

To save the data you get the saveinfo from the folderitem ( the doc link I gave you )

And to restore you use the Folderitem.FromSaveInfo
http://documentation.xojo.com/api/files/folderitem.html.FromSaveInfo