Game Development Community

Versus .

by Chaim Krause · in Torque Game Builder · 11/06/2007 (6:40 am) · 7 replies

I am confused on pathing and I cannot find a definitive answer. When using TGB 1.5 when should I start my paths with ./ and when should I start them with ~/ ?

#1
11/06/2007 (8:03 am)
If you're using the './', then the file must live in the same directory as the referencing file. Essentially, './' means the current directory. If you are using '~/', that refers to the root-child of the current file.

Lastly, you can just use '/project/file.cs' if you'd like, in which case the root is the directory of the executable.
#2
11/06/2007 (8:07 am)
Jason,

Thank you. I'm not sure I understand what you mean by "root-child". Could you provide an example?
#3
11/06/2007 (8:32 am)
It's a little confusing, right? It's actually a little bit like a UNIX shell, though instead of ~ being a user's home directory, it's a little different here. It's a little hard to explain, so be forgiving. Essentially, the root-child is the first directory below the executable, in which the current referencing file exists.
#4
11/06/2007 (8:40 am)
I think I understand. If the EXE is in directory A, and there are two subdirectories A1 and A2, and there is a script file somewhere under A1 (maybe even A2 or A3) then ~ would be A1 and if there is a script file somewhere under A2 then ~ would be A2. Am I close?
#5
11/06/2007 (9:14 am)
If your script file is here:
C:/projects/newgame/game/gamescripts/game.cs

And in this case newgame is the project directory (and the directory that contains your exe if you elected to copy it), Then ~ when used in the game.cs file, refers to the "game" directory, because it is the first directory below the executable, in which the current referencing file exists.

That last part sounds more confusing than it really is. Probably "game" is not the only folder under "newgame", most likely "common" is also there. But the script file game.cs is found under the "game" folder, so thats the one "in which the current referencing file exists".
#6
11/06/2007 (9:20 am)
Thanks James. That is what I was trying to say.

Can anybody answer:

1) Is this in the documentation? If so where?

2) If not, I will add this to the TDN wiki, but I need to know if there is an "official" name for this, or if it is actually called the "root-child" directory.

3) If it isn't documented, how did you determine this is how it works? I assume just by looking at existing/example project and experimenting.
#7
11/06/2007 (9:27 am)
I believe I also asked on the forums '-) I don't know if this is in the documentation, hopefully someone from GG responds.