Just checking to see if I can generate a weird situation.
I first noticed some folders weren’t being created.
After wondering what I’d done to do this, I remembered deleting a CreateFolder line because it was creating folders with the wrong names.
Oh I forgot to add it back in.
So I checked on the parent of the folder I wanted to create, and it didn’t it exist.
I then noticed I’m not getting an ioexception error on CreateFolder.
So. My question is do I have a weird situation. If the Parent to a folder that is being created does not exist, do YOU get an ioexception?
What do you expect that the above code does? How does your complete code look like? Please describe your problem more fully. For instance, here is a bug with aliases and folderitems and a full description: <https://xojo.com/issue/59530>
Under normal circumstances, the above line creates the folder.
Here’s a more complete example including the problem.
Var gf as folderitem = SpecialFolder.documents.child("top")
var tf as folderitem = gf.child("bottom")//gf doesn't exist
If tf = Nil Or Not tf.Exists Then tf.CreateFolder
I just tested this by putting it in at the top of my app, and it didn’t even blink.
BTW I tried CreateAsFolder too.
Var gf as folderitem = SpecialFolder.documents.child("top")
var tf as folderitem = gf.child("bottom")//gf doesn't exist
If (tf is Nil) Or (Not tf.Exists) Then
break
tf.CreateFolder
end if
and see if you actually stop at the break statement
one of the reasons NOT to use oneliners
FWIW here when I run that code and it does hit the break it DOES appear to create the top dir as well
But that fails - the variable does have the right path though
I would think that there should be an exception or something - but last error code is also still 0
dim gf as folderitem = SpecialFolder.documents.child("top")
if gf = nil or not gf.exists then
messagebox "error here"
return
end if
gf = gf.child("bottom")