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

For DiscUtils.Iso9660.CDBuilder I can't use single wildCard like cd.Root.GetFiles("*") #287

Open
nixxou opened this issue Jul 20, 2023 · 4 comments

Comments

@nixxou
Copy link

nixxou commented Jul 20, 2023

CDReader cd = new CDReader(fs, true, true);

cd.Root.GetFiles("") always return 0 results.
cd.Root.GetFiles("
.*") works fine, but when you want to return files that don't have extension, that's annoying.

@LTRData
Copy link

LTRData commented Sep 2, 2023

This is expected, or? cd.Root.GetFiles("") should return 0 results because a file name pattern can never be empty. Use cd.Root.GetFiles("*") when you want to return all entries.

@LeviGNMBS
Copy link

I am running into the same issue GetFiles("*") is returning 0 items as the wildcard conversion adds a point to the end by itself basically forcing every file in the filesystem to need a point in its name somewhere to be found, from source:

if (!pattern.Contains("."))
{
    pattern += ".";
}

public static Regex ConvertWildcardsToRegEx(string pattern)

So it is not possible to search files without a point (.) in the name? This is also incompatible with existing .net api as there a * can match any character including a . so it should find literally all files including those with a dot.

@LeviGNMBS
Copy link

LeviGNMBS commented Oct 17, 2023

Excuse my last post as it seems to be wrong, i was having another issue. The dot is not forced as a dot but as regex any character. However if i compare discutils with .net/windows i still see a difference:

.net Discutils
*.* All files All files
* All files Only files without dot
Default All files (using *) All files (using *.*)

@LTRData
Copy link

LTRData commented Oct 17, 2023

Okay, I understand now and yes, you are right. It comes down to a partially broken implementation with regular expressions to filter searches. It is not only broken, but the performance is also pretty bad. In my fork of DiscUtils, I did this a bit differently:
https://github.com/LTRData/DiscUtils/blob/2ef42f8202d670020dea87b61694997e2d2d8c24/Library/DiscUtils.Core/Internal/Utilities.cs#L398

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

No branches or pull requests

3 participants