FolderItem Strings?


Just curious if there is a simpler way of creating a FolderItem, this seems a little esoteric and leads me to think i am not doing this the best way?

	Dim f as FolderItem
	f = Volume(0).Child("Users").Child("me"). Child("Desktop").Child("test.txt")

I would expect (knowing nothing of Xojo) that I should be able to do this, but doens’t seem to work.
f.setPathAsString = “c:\users\me\desktop\test.txt”

Is there something I missed?

no offense but the Language Ref is you friend. :slight_smile:

Just be careful and check for NIL and EXISTS when creating a FolderItem using this or any other method

For your specific case you should use the SpecialFolder class:

Dim f as FolderItem f = SpecialFolder.Desktop.Child("test.txt")

If you know the path use SpecialFolder and the FolderItem methods. If you don’t know the path use an OpenDialog.

Search the forum to see the nightmares people have with GetFolderItem and the solution usually being SpecialFolder and the FolderItem methods.