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()); }
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)); }