Changeset 14 for Common/FileExt.cs


Ignore:
Timestamp:
Aug 2, 2022, 11:46:25 AM (2 years ago)
Author:
chronos
Message:
  • Modified: Various improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/FileExt.cs

    r5 r14  
    2323            } else File.WriteAllText(fileName, content);
    2424        }
     25
     26        public static string GetExactPathName(string pathName)
     27        {
     28            if (!(File.Exists(pathName) || Directory.Exists(pathName)))
     29                return pathName;
     30
     31            var di = new DirectoryInfo(pathName);
     32
     33            if (di.Parent != null)
     34            {
     35                return Path.Combine(
     36                    GetExactPathName(di.Parent.FullName),
     37                    di.Parent.GetFileSystemInfos(di.Name)[0].Name);
     38            }
     39            else
     40            {
     41                return di.FullName.ToUpper();
     42            }
     43        }
    2544    }
    2645}
Note: See TracChangeset for help on using the changeset viewer.