" and "~/" mean? Someone told me that if you put "./" it starts with the directory you are in and "~/" starts with the root... is this true? Also, when I try to exec scripts from "> "./" and "~/"? | General Discussion | Forums | Community | GarageGames.com

Game Development Community

"./" and "~/"?

by Jeff Peck · in General Discussion · 09/23/2002 (10:45 am) · 7 replies

Can someone please explain to me what exactly the "./" and "~/" mean? Someone told me that if you put "./" it starts with the directory you are in and "~/" starts with the root... is this true?

Also, when I try to exec scripts from the console using "exec" it doesn't want to work... how can I exec? I tried using exec("~/
Thanks in advance,
Sang

#1
09/23/2002 (10:57 am)
./ = look in current working directory

IE:

./SomExec

would be expanded to the current working directory, that is if you are in the /var/opt/oracle directory and you did a

vi ./tnsnames.ora

it would be expanded to

vi /var/opt/oracle/tnsnames.ora



==========


~/ = look in your home directory

IE:

~/SomeExec

would be expanded to your home directory, so if your home dir is /home/joe and you did

~/SomeExec

it would be expanded to

/home/joe/SomeExec

~ can also be used infront of a valid user name to indicate that users home dir

IE

cd ~cm

would change your working dir to cm's home dir


you could combine the above like

ls ~cm/junk which would be expanded to

ls /home/cm/junk
giving that the home dir of cm is /home/cm


Regards,

Ron
#2
09/23/2002 (10:59 am)
Yes, ./ is the current dir you're in, but the ~/ actually means MODNAME/, so it becomes e.g. "fps/" or "rw/" ...
If you'd like to use "exec()" in the console, you should use the "absolute" path, e.g.
exec("fps/server/scripts/game.cs");
#3
09/23/2002 (11:03 am)
heheheh

confusing TGE with *nix again *sigh*
sorry if my previous post off base, I read it as a *nix type question and replied accordingly
#4
09/23/2002 (11:41 am)
Ron

You're reply was actually correct if you replace "users home dir" with "Mod's Home Dir"
#5
09/23/2002 (8:26 pm)
Ron - No problem, thanks for the response! Thanks for helping me guys.

~ Sang
#6
10/17/2002 (7:39 pm)
What happens if exec() doesn't find the script its looking for? Does it produce and error or just ignore it, or search further somehow. Ive found a few examples in the RW system that don't seem to follow these rules. For examples:

c:\torque\example\rw\client\scripts\optionsDlg.cs has an exec("~/scripts/default.bind.cs"); call in it. By the rules Stefan describes (if I understand them right) this should point to:

c:\torque\example\rw\scripts\default.bind.cs

which doesn't exist. It's actually in teh same client/scripts dir as optionsDlg.cs

And

c:\torque\example\common\server\server.cs

calls ~/defaults.cs which would look in

c:\torque\example\common\defaults.cs

which doesn't exist.
#7
10/19/2002 (10:44 am)
that is just because those two files dont exist... they must have gotten deleted somewhere down the line.

you will see warnings in the console about it.