Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make easier to search files in a certain directory #2056

Open
Kralizek opened this issue Feb 24, 2018 · 7 comments
Open

Make easier to search files in a certain directory #2056

Kralizek opened this issue Feb 24, 2018 · 7 comments
Assignees

Comments

@Kralizek
Copy link

I often find myself in the situation of looking for files matching a certain pattern within a folder or below.

Here is a typical use case

As of today, executing dotnet test on a solution will try to find and execute tests on every project filling the log with errors because no testable project was found. This is why I prefer to find every project file within the tests directory hive.

Task("Test")
    .IsDependentOn("Build")
    .Does(() => 
{
    var testProjects = FindFilesInDirectory(testDirectory, "*.csproj", SearchScope.Recursive);

    foreach (var project in testProjects)
    {
        DotNetCoreTest(project.FullPath);
    }
});

I am aware that the same functionality is offered by IFileSystem but the result of IFileSystem.GetFiles is a list of IFile instead of FilePath. This is not convenient since most of the aliases work with FilePath.

@Kralizek
Copy link
Author

@patriksvensson

@patriksvensson
Copy link
Member

@Kralizek Great!

The name indicates that it returns files and not file paths. Perhaps it should be renamed to something like GetFilePaths instead?

I'm also curious to why this method takes a DirectoryPath, pattern and SearchScope instead of a glob pattern, such as $"{testDirectory}/**/*.csproj". This would be more constistent with the GetFiles alias that already exist.

@devlead: What is your opinion?

@Kralizek
Copy link
Author

I didn't like that I had to write GetFiles(testDirectory.FullPath + "/**/*.csproj"), but I didn't know that GetFiles($"{testDirectory}/**/*.csproj") is supported.

@DavidPerikala
Copy link

Hello. This looks interesting and I would like to work on it.
Can you elaborate a bit on what is needed. ?
I tried to get familiar with IFileSystem.GetFiles, But I couldn't locate it in the interface. Is it deprecated now?

@DurveshKumarPal
Copy link

Hey @augustoproiete , I would like to work on it Could you please Assigned to me.

@augustoproiete
Copy link
Member

@DurveshKumarPal all yours

@augustoproiete
Copy link
Member

Hey @DurveshKumarPal didn't hear back from you in a few months. Any chance you'll work on this soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants