2 * Namespace: System.Web.Util
\r
3 * Class: FilePathParser
\r
5 * Author: Gaurav Vaish
\r
6 * Maintainer: gvaish@iitk.ac.in
\r
7 * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
\r
8 * Implementation: yes
\r
11 * (C) Gaurav Vaish (2001)
\r
15 namespace System.Web.Util
\r
17 internal class FilePathParser
\r
19 private static char[] pathSeparators = {
\r
20 Path.DirectorySeparatorChar,
\r
21 Path.AltDirectorySeparatorChar
\r
24 private string dirName;
\r
25 private string fileName;
\r
26 private string shortDirName;
\r
27 private string shortFileName;
\r
29 private bool exists;
\r
32 public FilePathParser(string path, bool isFile, bool getShortNames)
\r
35 if(Path.GetPathRoot(path).Length < path.Length)
\r
37 path = path.TrimEnd(pathSeparators);
\r
41 dirName = GetBaseDirOrRoot(path);
\r
48 if(!Directory.Exists(dirName))
\r
53 shortDirName = GetShortPathName(dirName);
\r
54 if(shortDirName==null)
\r
59 if(shortDirName == dirName)
\r
61 shortDirName = null;
\r
64 throw new NotImplementedException();
\r
69 public static string GetBaseDirOrRoot(string file)
\r
71 string bDir = Path.GetDirectoryName(file);
\r
72 return ( bDir!=null ? bDir : Path.GetPathRoot(file));
\r
75 [MonoTODO("Native_Call_Required")]
\r
76 public static string GetShortPathName(string path)
\r
78 //TODO: Native calls required, it's in kernel32.dll for windows
\r
79 throw new NotImplementedException();
\r