Comments (3)
Yeah you are right - this needs sorting.
Firstly the doc should say
- Any Letter or Digit
Not just A-Z, a-z or Digit. Because it actually does Char.IsLetterOrDigit()
. So in your example for 你好!the first two of those characters return true for the IsLetterOrDigit
check so they are currently allowed.
The last character however !is categorised as unicode punctuation
and so fails the current check for a valid literal, but yes it is valid for a filename.
However taken into a wider context - I don't think this "allowed literal characters" limitation is really helping anything much and I think I should just remove it. Like you say the set of allowed characters will differ per platform and that's not something I want to get into really.
This originally evolved because I wanted to identify if a character was a literal, and I thought if there was a small subset / array I could check in that pretty quickly. But actually the better approach seems to be parse for literals last
after checking for other kinds of tokens, and then assume that as its not any other kind of token, then it must be a literal that remains. This way you only need to identify that the next character is not any other token rather than the next character is in a list of known good literal characters. The two checks are roughly the same performance wise.
So here is what I think I should do:
- Drop the set of allowed literal characters.
- Remove the option
AllowInvalidPathCharacters
.
The default behaviour will then just be that the character will be assumed to be a literal if it isn't parsed as any other token first - which is how AllowInvalidPathCharacters
= true behaves.
from dotnet.glob.
Yep, treating anything that isn't a special character as a literal makes sense to me
from dotnet.glob.
Thanks @cocowalla this will be releases in 2.1.0
from dotnet.glob.
Related Issues (20)
- IndexOutOfRangeException with ** HOT 9
- Bring dotnet glob to sql clr and ef core! HOT 2
- New option for parsing behaviour of invalid ** HOT 9
- Enable sourcelink HOT 1
- Fix build - GitVersion issue. HOT 2
- Build failing
- How to enumerate files and folders with glob? HOT 1
- Cannot build, deprecated dotnet dependencies and more HOT 2
- "**/.*" unexpectedly matches paths ending with dot HOT 4
- Glob failing on matching `/` with Index was outside the bounds of the array HOT 2
- Consider joining the .NET Foundation
- Double check character class logic HOT 1
- Composite character ranges
- Matching partial paths? HOT 2
- Having a dot after a wildcard in a pattern that also has literal directory and wildcard directory matchers can fail to match a valid path HOT 2
- Lots of bugs HOT 7
- Linux filenames with slashes HOT 3
- Multiple Glob Patterns HOT 2
- Inconsistent Matching HOT 2
- README fluent builder example is wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet.glob.