Solved

How to stay on the root directory

Posted on 2007-03-23
1
223 Views
Last Modified: 2010-04-16
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
Comment
Question by:brdrok
1 Comment
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 18780522
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question