public virtual void CreateDirectory(string newName) { if (String.IsNullOrEmpty(newName)) { throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "newName"); } try { // on a new dir && enter, we get called with the same name (so do nothing if name is the same char[] dummy = new char[1]; dummy[0] = Path.DirectorySeparatorChar; string oldDir = this.Url; oldDir = oldDir.TrimEnd(dummy); string strNewDir = Path.Combine(Path.GetDirectoryName(oldDir), newName); if (String.Compare(strNewDir, oldDir, StringComparison.OrdinalIgnoreCase) != 0) { if (Directory.Exists(strNewDir)) { throw new InvalidOperationException(SR.GetString(SR.DirectoryExistError, CultureInfo.CurrentUICulture)); } Directory.CreateDirectory(strNewDir); } } //TODO - this should not digest all exceptions. catch (System.Exception e) { CCITracing.Trace(e); throw; } }
public virtual void CreateDirectory() { try { if (Directory.Exists(this.Url) == false) { Directory.CreateDirectory(this.Url); } } //TODO - this should not digest all exceptions. catch (System.Exception e) { CCITracing.Trace(e); throw; } }