FolderItem.Child problem with spaces in path

Hi.
I have this path: C:\Users\AppData\Roaming\I am directory
Note the spaces in “I am directory”.

In XoJo 2021 Release 3 I do:
Var myPath As FolderItem = SpecialFolder.ApplicationData.Child("Roaming").Child("I am directory")
but is not recognized the path.

As a proof I do:

Var myPath As FolderItem = SpecialFolder.ApplicationData '-> OK, myPath is not NIL
myPath = myPath .Child("Roaming") '-> OK, myPath is not NIL
myPath = myPath .Child("I am directory") '-> ARGHH, myPath **IS NIL**

So I tried replacing the spaces with %20 :

Var myPath As FolderItem = SpecialFolder.ApplicationData '-> OK, myPath is not NIL
myPath = myPath .Child("Roaming") '-> OK, myPath is not NIL
myPath = myPath .Child("I%20am%20directory") '-> ARGHH, myPath IS NIL again !

Tips ?
Thanks in advance.

I do not think the directory is actually called that.
Why not loop through the children of Roaming, and examine the actual file names in the debugger?
Maybe there is a space at the start or end, maybe those spaces are tabs, maybe there are 2 spaces not one

SORRY…
My mistake. Excuse me…
I used Roaming twice !

Scusatemi
:ambulance:

1 Like

Yes SpecialFolder.ApplicationData = “\Users\UserName\AppData\Roaming”
http://documentation.xojo.com/api/files/specialfolder.html

The fact that a FolderItem is not nil does not imply that the corresponding file/folder actually exists.

Var myPath As FolderItem = SpecialFolder.ApplicationData '-> myPath.Exists=True
myPath = myPath .Child("Roaming") '-> myPath.Exists=False
myPath = myPath .Child("I am directory") '-> myPath=Nil
1 Like