Debug folder problem

In Real Studio, I’m used to writing something like

f=folderitem("").child.("tables").child("table1")

because I like to keep my files in a simple relative path from the folder with the program.

I was mystified for a while that this doesn’t work in Xojo, the reason being that during debug the top folder is the debug folder. So I am now writing

f=folderitem("").parent.child.("tables").child("table1")

Rather than try to keep things like this in mind for when I compile, can I include both somehow - one for the debug version and one to be used when I compile?

Thanks if you can help.

Hi Steve,

I cannot give you an answer for your question (*), but try to avoid assumptions like:

f=folderitem("").child.("tables").child("table1")

If one of the folder / file is missing, you will get an exception without knowing much more. Use a cascade with Nil / Not Exists checkings.

At last, I suppose “folderitem” is not a real command you use 'cause I do not know it.

(*): I suppose it have to work in Xojo because I also use this kind of things (getting a reference to the application Folder and use Child(“My own file or folder”)…

It sounds as you are describing what happens with a windows environment. Here is a way :

#If DebugBuild Then f=folderitem("").parent.child.("tables").child("table1") #else f=folderitem("").child.("tables").child("table1") #Endif

Thanks Michel, that’s exactly what I was hoping for. It will save me puzzling for ages when I first compile it properly in a few weeks time and find that nothing works!

[quote=71603:@Steve Hill]In Real Studio, I’m used to writing something like

f=folderitem("").child.("tables").child("table1")

because I like to keep my files in a simple relative path from the folder with the program.
[/quote]
You must have been using a fairly old version of REAL Studio as this behavior is not new to Xojo