FolderItemDialog.InitialFolder

Hello,

i want to open the “Data” folder in my CurrentWorkingDirectory

dlg.InitialFolder = SpecialFolder.CurrentWorkingDirectory + “\Data” doesn’t work.
Maybe it is to easy to write it in the documentation?

You’re trying to append a string to a FolderItem and that’s not going to work. You need to either specify the nativePath in the statement such as

dlg.InitialFolder = SpecialFolder.CurrentWorkingDirectory.NativePath + "\Data"

or, preferably, designate the Data folder as a child of the working folder, like
dlg.InitialFolder = SpecialFolder.CurrentWorkingDirectory.Child("Data")

(Untested so the actual code may differ.)

Thanks for helping!
dlg.InitialFolder = SpecialFolder.CurrentWorkingDirectory
shows the “xojo 2020r1.2” folder from Xojo itself. That is not the folder of my app.

dlg.InitialFolder = SpecialFolder.CurrentWorkingDirectory.Child("Data")
and variations doesn’t work.

dlg.InitialFolder = SpecialFolder.Resources
shows my resources! That works! But my folder is at “.\ ,.\Data”

dlg.InitialFolder = SpecialFolder.Resources.Child(anything)
jumps always to the documents :frowning:

Interesting!

dlg.InitialFolder = SpecialFolder.CurrentWorkingDirectory.Child("XData")
The “X” means " \ " and " .\ " and “”. All three versions are working today.
Yesterday nothing works. Maybe the path “system” was confused?