You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CON, AUX, LPT, etc. were reserved names in MsDos. For compatibility Windows Explorer still prevents you from creating files or directories with those names. But in fact Windows internally does support it (like it supports long filenames even tho the Explorer does not).
Would be great if those names would be handled correctly.
The following example demonstrates that. Pri.LongPath is not able to create a directory named "aux".
using System;using System.Runtime.InteropServices;using Pri.LongPath;namespaceMetaTree{classProgram{//Make sure temp already exists!privatereadonlystaticstringtemp=@"D:\Temp\";staticvoidMain(string[]args){//[System.ArgumentException]: The UNC path should be of the form \\server\share.
Directory.CreateDirectory(temp+"aux");//With the WinAPI a prefix is needed, but it works
CreateDirectory(@"\\?\"+temp+"aux", IntPtr.Zero);//Removes the aux Folder//WARNING: The "aux" folder can not be removed with the windows explorer
RemoveDirectory(@"\\?\"+temp+"aux");}[DllImport("kernel32.dll")][return:MarshalAs(UnmanagedType.Bool)]staticexternboolCreateDirectory(stringlpPathName,IntPtrlpSecurityAttributes);[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError =true)]staticexternboolRemoveDirectory(stringlpPathName);}}
The text was updated successfully, but these errors were encountered:
CON
,AUX
,LPT
, etc. were reserved names in MsDos. For compatibility Windows Explorer still prevents you from creating files or directories with those names. But in fact Windows internally does support it (like it supports long filenames even tho the Explorer does not).Would be great if those names would be handled correctly.
The following example demonstrates that. Pri.LongPath is not able to create a directory named "aux".
The text was updated successfully, but these errors were encountered: