Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualServant of the Lord

Posted 24 January 2013 - 11:53 AM

It's always the current working directory, I believe.

So you are saying, under Windows, the single dot always indicates the current working directory and not the executable directory, unless they happen to be the same (which is most of the time)?
 
Is it the same on Mac and Linux?

You could always whip up a quick program to find out, though!

I don't currently have access to a Mac and I don't have Linux installed, so I can't currently try it out.
 

Windows:
Anything that does not explicitly specify a drive is relative to the working directory, so the period has no real meaning on Windows.  The working directory is often the same as the executable directory but could be different if the executable changes it at run-time, it is run under Visual Studio, or run from a .bat file located elsewhere (the working directory will be that of the .bat file).

Thank you, that helps.
 
And in the situation of running from a command-line prompt like this:

C:/> CD C:/path/to/folder/
C:/path/to/folder/> ../../different/folder/program.exe

 
'program.exe' will have the current working directory of 'C:/path/to/folder/ ', and not 'C:/path/different/folder/?
 

Mac OS X is Unix based, thus it inherits most of its features, including the paths.
In Unix- based OS, such as Linux, 
. = current directory
.. = parent directory

So is the 'current directory' the "directory of the executable", or "the current working directory of the environment"?
 

Anything else [speaking of Unix-like systems] is considered relative paths (so folder/file  and  ./folder/file   and  ../myfolder/folder/file are all relative paths).

Thanks, I was wondering about that. So folder/file and ./folder/file would be the same directory?



[Edit:] Fixed broken quotes a day later.

#1Servant of the Lord

Posted 23 January 2013 - 07:32 PM

It's always the current working directory, I believe.

So you are saying, under Windows, the single dot always indicates the current working directory and not the executable directory, unless they happen to be the same (which is most of the time)?

 

Is it the same on Mac and Linux?


You could always whip up a quick program to find out, though!


I don't currently have access to a Mac and I don't have Linux installed, so I can't currently try it out.

 

Windows:
Anything that does not explicitly specify a drive is relative to the working directory, so the period has no real meaning on Windows.  The working directory is often the same as the executable directory but could be different if the executable changes it at run-time, it is run under Visual Studio, or run from a .bat file located elsewhere (the working directory will be that of the .bat file).

Thank you, that helps.
 
And in the situation of running from a command-line prompt like this:

C:/> CD C:/path/to/folder/

C:/path/to/folder/> ../../different/folder/program.exe

 
'program.exe' will have the current working directory of 'C:/path/to/folder/ ', and not 'C:/path/different/folder/?
 

Mac OS X is Unix based, thus it inherits most of its features, including the paths.
In Unix- based OS, such as Linux, 
. = current directory
.. = parent directory

So is the 'current directory' the "directory of the executable", or "the current working directory of the environment"?
 

Anything else [speaking of Unix-like systems] is considered relative paths (so folder/file[u]  [and]  [u]./folder/file[u]   and  [u]../myfolder/folder/file are all relative paths).

Thanks, I was wondering about that. So folder/file and ./folder/file would be the same directory?

 


PARTNERS