public TempFile(TempDir baseDir, string fileName = "") { if (PathModule.IsPath(fileName)) { throw new ArgumentException("fileName is not allowed to be a path.", nameof(fileName)); } _baseDir = baseDir; _fileName = fileName; }
public TempDir(string basePath, string dirName) { Contract.Requires(!string.IsNullOrWhiteSpace(basePath)); Contract.Requires(!string.IsNullOrWhiteSpace(dirName)); if (PathModule.IsPath(dirName)) { throw new ArgumentException("dirName is not allowed to be a path.", nameof(dirName)); } _basePath = basePath; _dirName = dirName; _files = new List <TempFile>(); }
public WorkingDir(string basePath, string dirName = "") { if (PathModule.IsPath(dirName)) { throw new ArgumentException("dirName is not allowed to be a path.", nameof(dirName)); } if (string.IsNullOrWhiteSpace(dirName)) { _basePath = Path.GetDirectoryName(basePath); _dirName = PathModule.GetLastDirectoryName(basePath); } else { _basePath = basePath; _dirName = dirName; } }