コード例 #1
0
        private static void doCreateDirectory(string directoryPath)
        {
            directoryPath = CheckAddLongPathPrefix(directoryPath);

            if (!PInvokeHelper.CreateDirectory(directoryPath, IntPtr.Zero))
            {
                // http://msdn.microsoft.com/en-us/library/ms681382(VS.85).aspx.

                var lastWin32Error = Marshal.GetLastWin32Error();
                throw new Win32Exception(
                          lastWin32Error,
                          string.Format(
                              Resources.ErrorCreatingDirectory,
                              lastWin32Error,
                              directoryPath,
                              CheckAddDotEnd(new Win32Exception(lastWin32Error).Message)));
            }
        }