Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Mon, 25 Aug 2008 07:37:16 -0700 (PDT),    group: microsoft.public.dotnet.framework        back       


Directory.GetCurrentDirectory()   
The documentation for “Directory.GetCurrentDirectory()” states:

Gets the current working directory of the application.

My problem is that I am not sure what that means.

1) What does the current directory represents?
2) I this value set by Windows when a process starts?
3) Is this value set once by Windows and never updated again unless I
manually update it?

Thanks.
date: Mon, 25 Aug 2008 07:37:16 -0700 (PDT)   author:   unknown

Re: Directory.GetCurrentDirectory()   
On Mon, 25 Aug 2008 07:37:16 -0700,  wrote:

> The documentation for “Directory.GetCurrentDirectory()” states:
>
> Gets the current working directory of the application.
>
> My problem is that I am not sure what that means.
>
> 1) What does the current directory represents?

The Windows file API has the concept of "the current directory".  When you  
specify a relative path, it's relative to "the current directory".  It's  
better to always specify absolute paths though, so "the current directory"  
is of somewhat limited use.

It's good to know what it is, but it's better for your own code to not  
rely on it.

> 2) I[s] this value set by Windows when a process starts?

Yes.

> 3) Is this value set once by Windows and never updated again unless I
> manually update it?

That depends.  For example, the common file dialogs can modify it, unless  
you tell them not to.

Pete
date: Mon, 25 Aug 2008 10:14:43 -0700   author:   Peter Duniho

Re: Directory.GetCurrentDirectory()   
Thanks Pete,

So, looks like the current directory value is initialized with the
folder path where the exe that created the process is located at.
After that, looks like you can change it to just about any value that
you want.

Thanks again.


On Aug 25, 12:14 pm, "Peter Duniho" 
wrote:
> On Mon, 25 Aug 2008 07:37:16 -0700,  wrote:
> > The documentation for “Directory.GetCurrentDirectory()” states:
>
> > Gets the current working directory of the application.
>
> > My problem is that I am not sure what that means.
>
> > 1) What does the current directory represents?
>
> The Windows file API has the concept of "the current directory".  When you  
> specify a relative path, it's relative to "the current directory".  It's  
> better to always specify absolute paths though, so "the current directory"  
> is of somewhat limited use.
>
> It's good to know what it is, but it's better for your own code to not  
> rely on it.
>
> > 2) I[s] this value set by Windows when a process starts?
>
> Yes.
>
> > 3) Is this value set once by Windows and never updated again unless I
> > manually update it?
>
> That depends.  For example, the common file dialogs can modify it, unless  
> you tell them not to.
>
> Pete
date: Mon, 25 Aug 2008 14:37:52 -0700 (PDT)   author:   unknown

Re: Directory.GetCurrentDirectory()   
On Mon, 25 Aug 2008 14:37:52 -0700,  wrote:

> Thanks Pete,
>
> So, looks like the current directory value is initialized with the
> folder path where the exe that created the process is located at.

By default.  For shortcuts (which is how people usually start Windows  
programs) you can set the initial working directory in the shortcut  
itself, different from the directory where the application resides.

> After that, looks like you can change it to just about any value that
> you want.

Yes.

Pete
date: Mon, 25 Aug 2008 15:25:26 -0700   author:   Peter Duniho

Re: Directory.GetCurrentDirectory()   
On Aug 26, 1:37 am, qglyirnyf...@mailinator.com wrote:
> Thanks Pete,
>
> So, looks like the current directory value is initialized with the
> folder path where the exe that created the process is located at.

Not really. If I start your application from the command line, for
example, the current directory will remain whatever it was for
cmd.exe. So, in case of:

  C:\> c:\foo\bar\baz.exe

The current directory for baz.exe will be C:\
date: Tue, 26 Aug 2008 06:58:49 -0700 (PDT)   author:   Pavel Minaev

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us