internal UnixFileSystemInfo(String path, Native.Stat stat) { this.originalPath = path; this.fullPath = UnixPath.GetFullPath(path); this.stat = stat; this.valid = true; }
public UnixFileSystemInfo GetContents() { ReadLink(); return(UnixFileSystemInfo.GetFileSystemEntry( UnixPath.Combine(UnixPath.GetDirectoryName(FullPath), ContentsPath))); }
protected UnixFileSystemInfo(string path) { UnixPath.CheckPath(path); this.originalPath = path; this.fullPath = UnixPath.GetFullPath(path); Refresh(true); }
public static string GetCompleteRealPath(string path) { string[] strArrays; int num; if (path == null) { throw new ArgumentNullException("path"); } UnixPath.GetPathComponents(path, out strArrays, out num); StringBuilder stringBuilder = new StringBuilder(); if ((int)strArrays.Length > 0) { string str = string.Concat((!UnixPath.IsPathRooted(path) ? string.Empty : "/"), strArrays[0]); stringBuilder.Append(UnixPath.GetRealPath(str)); } for (int i = 1; i < num; i++) { stringBuilder.Append("/").Append(strArrays[i]); string realPath = UnixPath.GetRealPath(stringBuilder.ToString()); stringBuilder.Remove(0, stringBuilder.Length); stringBuilder.Append(realPath); } return(stringBuilder.ToString()); }
private UnixFileSystemInfo[] GetFileSystemEntries(Dirent[] dentries) { UnixFileSystemInfo[] fileSystemEntry = new UnixFileSystemInfo[(int)dentries.Length]; for (int i = 0; i != (int)fileSystemEntry.Length; i++) { fileSystemEntry[i] = UnixFileSystemInfo.GetFileSystemEntry(UnixPath.Combine(base.FullPath, new string[] { dentries[i].d_name })); } return(fileSystemEntry); }
private UnixFileSystemInfo[] GetFileSystemEntries(Native.Dirent[] dentries) { UnixFileSystemInfo[] entries = new UnixFileSystemInfo[dentries.Length]; for (int i = 0; i != entries.Length; ++i) { entries [i] = UnixFileSystemInfo.GetFileSystemEntry( UnixPath.Combine(FullPath, dentries[i].d_name)); } return(entries); }
public static string GetCanonicalPath(string path) { string[] strArrays; int num; UnixPath.GetPathComponents(path, out strArrays, out num); string str = string.Join("/", strArrays, 0, num); return(!UnixPath.IsPathRooted(path) ? str : string.Concat("/", str)); }
public static string ReadLink(string path) { Errno errno; path = UnixPath.ReadSymbolicLink(path, out errno); if ((int)errno != 0) { UnixMarshal.ThrowExceptionForError(errno); } return(path); }
private static string _GetFullPath(string path) { if (path == null) { throw new ArgumentNullException("path"); } if (!UnixPath.IsPathRooted(path)) { path = string.Concat(UnixDirectoryInfo.GetCurrentDirectory(), UnixPath.DirectorySeparatorChar, path); } return(path); }
public static string GetPathRoot(string path) { if (path == null) { return(null); } if (!UnixPath.IsPathRooted(path)) { return(string.Empty); } return("/"); }
public static string GetDirectoryName(string path) { UnixPath.CheckPath(path); int num = path.LastIndexOf(UnixPath.DirectorySeparatorChar); if (num > 0) { return(path.Substring(0, num)); } if (num == 0) { return("/"); } return(string.Empty); }
public static string Combine(string path1, params string[] paths) { if (path1 == null) { throw new ArgumentNullException("path1"); } if (paths == null) { throw new ArgumentNullException("paths"); } if (path1.IndexOfAny(UnixPath._InvalidPathChars) != -1) { throw new ArgumentException("Illegal characters in path", "path1"); } int length = path1.Length; int num = -1; for (int i = 0; i < (int)paths.Length; i++) { if (paths[i] == null) { throw new ArgumentNullException(string.Concat("paths[", i, "]")); } if (paths[i].IndexOfAny(UnixPath._InvalidPathChars) != -1) { throw new ArgumentException("Illegal characters in path", string.Concat("paths[", i, "]")); } if (UnixPath.IsPathRooted(paths[i])) { length = 0; num = i; } length = length + paths[i].Length + 1; } StringBuilder stringBuilder = new StringBuilder(length); if (num == -1) { stringBuilder.Append(path1); num = 0; } for (int j = num; j < (int)paths.Length; j++) { UnixPath.Combine(stringBuilder, paths[j]); } return(stringBuilder.ToString()); }
public static string GetRealPath(string path) { while (true) { string str = UnixPath.ReadSymbolicLink(path); if (str == null) { break; } if (!UnixPath.IsPathRooted(str)) { path = string.Concat(UnixPath.GetDirectoryName(path), UnixPath.DirectorySeparatorChar, str); path = UnixPath.GetCanonicalPath(path); } else { path = str; } } return(path); }
public UnixFileSystemInfo GetContents() { this.ReadLink(); return(UnixFileSystemInfo.GetFileSystemEntry(UnixPath.Combine(UnixPath.GetDirectoryName(base.FullPath), new string[] { this.ContentsPath }))); }
public static string TryReadLink(string path) { Errno errno; return(UnixPath.ReadSymbolicLink(path, out errno)); }
public static string GetFullPath(string path) { path = UnixPath._GetFullPath(path); return(UnixPath.GetCanonicalPath(path)); }