示例#1
0
        public void Create(string path)
        {
            LongPath longPath = new LongPath(path);

            bool result;

            if (KtmTransaction.IsInTransaction)
            {
                result = WindowsNative.CreateDirectoryTransacted(null, longPath.PathString, IntPtr.Zero, KtmTransaction.Current.Hanlde);
            }
            else
            {
                result = WindowsNative.CreateDirectory(longPath.PathString, IntPtr.Zero);
            }
            if (!result)
            {
                int errorCode = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
                if (errorCode != WindowsNative.ERROR_ALREADY_EXISTS || !longPath.Exists())
                {
                    WindowsNative.HandleWindowsError(errorCode);
                }
            }
        }