bool IDirectoryAdapter.Create(string path) { AssertAllowed(path); try { #if !MONO var maybe = CurrentTransaction(); if (maybe.HasValue) { return(((IDirectoryAdapter)maybe.Value).Create(path)); } #endif if (((IDirectoryAdapter)this).Exists(path)) { return(true); } LongPathDirectory.Create(path); } catch (UnauthorizedAccessException e) { throw new UnauthorizedAccessException(string.Format("Access is denied for path '{0}', see inner exception for details.", path), e); } return(true); }
public static void Create(string path) { if (path.Length < MAX_PATH) { System.IO.Directory.CreateDirectory(path); } else { LongPathDirectory.Create(path); } }
private void OnCreateDirectoryButtonClick(object sender, EventArgs e) { try { string path = Path.Combine(this.currentPath.Text, fileNameTextBox.Text); LongPathDirectory.Create(path); } catch (ArgumentException ex) { ShowError(ex); } catch (IOException ex) { ShowError(ex); } catch (UnauthorizedAccessException ex) { ShowError(ex); } RefreshFileList(); }
/// <summary> /// 自动创建多层级路径 /// </summary> /// <param name="path"></param> /// <param name="separator">路径分隔符,默认:/</param> public static void createDirectory(string path, char separator = '/') { var dirs = path.Split(separator); var folder = ""; foreach (var dir in dirs) { if (folder != "") { folder = folder + "/" + dir; } else { folder = dir; } if (!LongPathDirectory.Exists(folder)) { LongPathDirectory.Create(folder); } System.Diagnostics.Debug.WriteLine(folder); } }
public virtual Directory Create() { LongPathDirectory.Create(Path); return(this); }
public override void CreateDirectory(string directoryPath) { LongPathDirectory.Create(directoryPath); }