Changeset 1174
- Timestamp:
- 2007-12-04 14:16:53 (8 months ago)
- Location:
- FCKeditor.Net/trunk
- Files:
-
- 2 modified
-
Util.cs (modified) (1 diff)
-
_whatsnew.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor.Net/trunk/Util.cs
r1167 r1174 56 56 public static DirectoryInfo CreateDirectory( string path ) 57 57 { 58 ArrayList oDirsToCreate = new ArrayList() ;59 60 58 // Create the directory info object for that dir (normalized to its absolute representation). 61 59 DirectoryInfo oDir = new DirectoryInfo( Path.GetFullPath( path ) ) ; 62 60 61 try 62 { 63 // Try to create the directory by using standard .Net features. (#415) 64 if ( !oDir.Exists ) 65 oDir.Create(); 66 67 return oDir; 68 } 69 catch 70 { 71 CreateDirectoryUsingDll( oDir ); 72 73 return new DirectoryInfo( path ); 74 } 75 } 76 77 private static void CreateDirectoryUsingDll( DirectoryInfo dir ) 78 { 79 // On some occasion, the DirectoryInfo.Create() function will 80 // throw an error due to a bug in the .Net Framework design. For 81 // example, it may happen that the user has no permissions to 82 // list entries in a lower level in the directory path, and the 83 // Create() call will simply fail. 84 // To workaround it, we use mkdir directly. 85 86 ArrayList oDirsToCreate = new ArrayList(); 87 63 88 // Check the entire path structure to find directories that must be created. 64 while ( oDir != null && !oDir.Exists )89 while ( dir != null && !dir.Exists ) 65 90 { 66 oDirsToCreate.Add( oDir.FullName );67 oDir = oDir.Parent;91 oDirsToCreate.Add( dir.FullName ); 92 dir = dir.Parent; 68 93 } 69 94 70 // " oDir == null" means that the check arrives in the root and it doesn't exist too.71 if ( oDir == null )72 throw ( new System.IO.DirectoryNotFoundException( "Directory \"" + oDirsToCreate[ oDirsToCreate.Count-1 ] + "\" not found." ) );95 // "dir == null" means that the check arrives in the root and it doesn't exist too. 96 if ( dir == null ) 97 throw ( new System.IO.DirectoryNotFoundException( "Directory \"" + oDirsToCreate[ oDirsToCreate.Count - 1 ] + "\" not found." ) ); 73 98 74 99 // Create all directories that must be created (from bottom to top). 75 for ( int i = oDirsToCreate.Count - 1 ; i >= 0 ; i-- )100 for ( int i = oDirsToCreate.Count - 1 ; i >= 0 ; i-- ) 76 101 { 77 string sPath = (string)oDirsToCreate[ i];78 int iReturn = _mkdir( sPath ) ;102 string sPath = (string)oDirsToCreate[ i ]; 103 int iReturn = _mkdir( sPath ); 79 104 80 105 if ( iReturn != 0 ) 81 throw new ApplicationException( "Error calling [msvcrt.dll]:_wmkdir(" + sPath + "), error code: " + iReturn );106 throw new ApplicationException( "Error calling [msvcrt.dll]:_wmkdir(" + sPath + "), error code: " + iReturn ); 82 107 } 83 84 return new DirectoryInfo( path ) ;85 108 } 86 109 } -
FCKeditor.Net/trunk/_whatsnew.html
r1173 r1174 65 65 and uploader will now correctly handle the Tilde ("~") in the UserFilesPath setting. 66 66 </li> 67 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/415">#415</a>] The file 68 browser connector will not work properly on "Medium" trust web sites.</li> 67 69 </ul> 68 70 <h3>