• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

How to stay on the root directory

Hi,

I have a property that looks like the following:

public static string RootDirectory
{
   get
   {
      string current = Directory.GetCurrentDirectory();
      string root = Directory.GetDirectoryRoot(current);
      return root;
   }
}

Somewhere while the program goes through its progression, the directory points to a mapped network drive called "Q:".  I would like to know how to remain on my root directory in which the application is running (in this case the C:\ drive).

Tnanks
0
brdrok
Asked:
brdrok
1 Solution
 
Jens FiedererCommented:
Either don't change directories in your program, or store the directory when your program starts to a static, and find your root off of that STORED directory rather than the current.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now