public override IList <IActivityIOPath> ExecuteOperation() { try { if (_impersonatedUser != null) { return(ExecuteOperationWithAuth()); } if (!Dev2ActivityIOPathUtils.IsStarWildCard(_newPath)) { if (_dirWrapper.Exists(_newPath)) { return(AddDirsToResults(GetDirectoriesForType(_newPath, string.Empty, _type, _dirWrapper), _path)); } throw new Exception(string.Format(ErrorResource.DirectoryDoesNotExist, _newPath)); } var baseDir = Dev2ActivityIOPathUtils.ExtractFullDirectoryPath(_newPath); var pattern = Dev2ActivityIOPathUtils.ExtractFileName(_newPath); return(AddDirsToResults(GetDirectoriesForType(baseDir, pattern, _type, _dirWrapper), _path)); } catch (Exception exception) { Dev2Logger.Error(exception, GlobalConstants.WarewolfError); throw new Exception(string.Format(ErrorResource.DirectoryNotFound, _path.Path)); } }
public void IsStarWildCard_Given_Star_In_Path_Returns_True() { const string resourcesPath = @"C:\ProgramData\Warewolf\*.*"; var results = Dev2ActivityIOPathUtils.IsStarWildCard(resourcesPath); Assert.IsTrue(results); }
public static enPathType PathIs(IActivityIOPath path, IFile fileWrapper, IDirectory dirWrapper) { if (Dev2ActivityIOPathUtils.IsDirectory(path.Path)) { return(enPathType.Directory); } if ((FileExist(path, fileWrapper) || DirectoryExist(path, dirWrapper)) && !Dev2ActivityIOPathUtils.IsStarWildCard(path.Path)) { var fa = fileWrapper.GetAttributes(path.Path); if ((fa & FileAttributes.Directory) == FileAttributes.Directory) { return(enPathType.Directory); } } return(enPathType.File); }