src/SyncTool.FileSystem/main/Local/LocalItemCreatorExtensions.cs
/// <summary>
/// Creates all the children of the specified directory in the specified path 
/// </summary>        
/// <param name="visitor"></param>
/// <param name="directory">The directory to create</param>
/// <param name="createIn">The filesystem path to create the directory in</param>
/// <param name="deleteExisting">
/// If set to true, and the specified path already exists,
/// all files currently at that path will be deleted before the directory is created in the specified location
/// </param>
Creates all the children of the specified directory in the specified path
Creates all the children of the specified directory in the specified path
public static void CreateDirectoryInPlace(this LocalItemCreator visitor, IDirectory directory, string createIn, bool deleteExisting = false)
        {
            if (deleteExisting && NativeDirectory.Exists(createIn))
            {
                NativeDirectory.Delete(createIn, true);
            }
            var name = Path.GetFileName(createIn.Trim("\\//".ToCharArray()));
            createIn = Path.GetDirectoryName(createIn);
            visitor.CreateDirectory(new Directory(name, directory.Directories, directory.Files), createIn);            
        }
public static void CreateDirectoryInPlace ( this LocalItemCreator visitor , IDirectory directory , string createIn , bool deleteExisting = false ) { if ( deleteExisting && NativeDirectory . Exists ( createIn ) ) { NativeDirectory . Delete ( createIn , true ) ; } var name = Path . GetFileName ( createIn . Trim ( " \\ " . ToCharArray ( ) ) ) ; createIn = Path . GetDirectoryName ( createIn ) ; visitor . CreateDirectory ( new Directory ( name , directory . Directories , directory . Files ) , createIn ) ; }
Creates all the children of the specified directory in the specified path
Creates all the children of the specified directory in the specified path
LocalItemCreator
this
directory
IDirectory
The directory to create
The directory to create
createIn
string
The filesystem path to create the directory in
The filesystem path to create the directory in
deleteExisting
bool
If set to true, and the specified path already exists,
all files currently at that path will be deleted before the directory is created in the specified location
If set to true and the specified path already exists all files currently at that path will be deleted before the directory is created in the specified location
visitor
None