[DllImport("msvcrt.dll", SetLastError=true)]
private static extern int _mkdir(string path) ;
ArrayList oDirsToCreate = new ArrayList() ;
// Create the directory info object for that dir (normalized to its absolute representation).
DirectoryInfo oDir = new DirectoryInfo( Path.GetFullPath( path ) ) ;
// Check the entire path structure to find directories that must be created.
while ( oDir != null && !oDir.Exists )
{
oDirsToCreate.Add( oDir.FullName ) ;
oDir = oDir.Parent ;
}
// "oDir == null" means that the check arrives in the root and it doesn't exist too.
if ( oDir == null )
throw( new System.IO.DirectoryNotFoundException( "Directory \"" + oDirsToCreate[ oDirsToCreate.Count-1 ] + "\" not found." ) ) ;
// Create all directories that must be created (from bottom to top).
for( int i = oDirsToCreate.Count - 1 ; i >= 0 ; i-- )
{
string sPath = (string)oDirsToCreate[i] ;
int iReturn = _mkdir( sPath ) ;
if ( iReturn != 0 )
throw new ApplicationException("Error calling [msvcrt.dll]:_wmkdir(" + sPath + "), error code: " + iReturn );
}
System.IO.Directory.CreateDirectory(path);
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: Util.cs
* Useful tools.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
using System ;
using System.Runtime.InteropServices ;
using System.IO ;
using System.Collections ;
namespace FredCK.FCKeditorV2
{
public sealed class Util
{
private Util()
{}
public static DirectoryInfo CreateDirectory( string path )
{
System.IO.Directory.CreateDirectory(path);
return new DirectoryInfo( path ) ;
}
}
}
Re: Securety exception on browse
Re: Security exception on browse
[DllImport("msvcrt.dll", SetLastError=true)] private static extern int _mkdir(string path) ;ArrayList oDirsToCreate = new ArrayList() ; // Create the directory info object for that dir (normalized to its absolute representation). DirectoryInfo oDir = new DirectoryInfo( Path.GetFullPath( path ) ) ; // Check the entire path structure to find directories that must be created. while ( oDir != null && !oDir.Exists ) { oDirsToCreate.Add( oDir.FullName ) ; oDir = oDir.Parent ; } // "oDir == null" means that the check arrives in the root and it doesn't exist too. if ( oDir == null ) throw( new System.IO.DirectoryNotFoundException( "Directory \"" + oDirsToCreate[ oDirsToCreate.Count-1 ] + "\" not found." ) ) ; // Create all directories that must be created (from bottom to top). for( int i = oDirsToCreate.Count - 1 ; i >= 0 ; i-- ) { string sPath = (string)oDirsToCreate[i] ; int iReturn = _mkdir( sPath ) ; if ( iReturn != 0 ) throw new ApplicationException("Error calling [msvcrt.dll]:_wmkdir(" + sPath + "), error code: " + iReturn ); }/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2005 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: Util.cs * Useful tools. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ using System ; using System.Runtime.InteropServices ; using System.IO ; using System.Collections ; namespace FredCK.FCKeditorV2 { public sealed class Util { private Util() {} public static DirectoryInfo CreateDirectory( string path ) { System.IO.Directory.CreateDirectory(path); return new DirectoryInfo( path ) ; } } }IMPORTANT: