Recognize a mapped network path

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

can anyone tell me how I can find out if e.g.

"T:\Folder\SubFolder"

is a mapped networkdrive or a local drive when I
get this string from a file open dialog ?

Thanks

HKannen
 
This is one way to find it:

[DllImport("kernel32.dll")]
public static extern int GetDriveType (string lpRootPathName);

string s = @"T:\Folder\SubFolder";
int i = s.IndexOf (Path.DirectorySeparatorChar);
s = s.Substring (0, i+1);

if (GetDriveType (s) == 4)
{
Console.WriteLine (s + " is a network mapped drive");
}

HTH

Hi,

can anyone tell me how I can find out if e.g.

"T:\Folder\SubFolder"

is a mapped networkdrive or a local drive when I
get this string from a file open dialog ?

Thanks

HKannen
 
Back
Top