Beispiel #1
0
        public static bool Exists(string path)
        {
            if (Program.rvSettings.IsUnix)
            {
                return(System.IO.File.Exists(path));
            }


            string fixPath = NameFix.AddLongPathPrefix(path);

            Win32Native.WIN32_FILE_ATTRIBUTE_DATA wIn32FileAttributeData = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();

            bool b = Win32Native.GetFileAttributesEx(fixPath, 0, ref wIn32FileAttributeData);

            return(b && (wIn32FileAttributeData.fileAttributes & Win32Native.FILE_ATTRIBUTE_DIRECTORY) == 0);
        }
Beispiel #2
0
        public DirectoryInfo(string path)
        {
            FullName = path;
            Name     = Path.GetFileName(path);

            string fileName = NameFix.AddLongPathPrefix(path);

            Win32Native.WIN32_FILE_ATTRIBUTE_DATA wIn32FileAttributeData = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();

            bool b = Win32Native.GetFileAttributesEx(fileName, 0, ref wIn32FileAttributeData);

            if (!b || (wIn32FileAttributeData.fileAttributes & Win32Native.FILE_ATTRIBUTE_DIRECTORY) == 0)
            {
                return;
            }
            LastWriteTime  = Convert.Time(wIn32FileAttributeData.ftLastWriteTimeHigh, wIn32FileAttributeData.ftLastWriteTimeLow);
            fileAttributes = wIn32FileAttributeData.fileAttributes;
        }