Beispiel #1
0
        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;
        }
Beispiel #2
0
        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>();
        }
Beispiel #3
0
        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;
            }
        }