How to stay on the root directory


I have a property that looks like the following:

public static string RootDirectory
      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).

Who is Participating?
Jens FiedererConnect With a Mentor Test Developer/ValidatorCommented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.