Ironclad / rivet

The open-source visual AI programming environment and TypeScript library
https://rivet.ironcladapp.com
MIT License
2.71k stars 237 forks source link

[Bug]: Read Directory node: glob and exclude don't work on windows #304

Open mindplay-dk opened 8 months ago

mindplay-dk commented 8 months ago

What happened?

In the Read Directory node, filter glob and excludes don't seem to work properly on Windows?

For example, if I enter **/*.php into filter glob, and **/vendor/**/* into excludes, the result includes everything from the vendor folder just the same.

I also tried using filter globs without excludes, instead using filter globs such as **/app/**/*.php - the produces no results.

I suspect maybe the backslashes in Windows paths is throwing off whatever implements glob support?

What was the expected functionality?

Filter and exclude globs should work.

Describe your environment

Windows 11 Pro

Relevant log output

No response

Relevant screenshots

No response

Code of Conduct

Natfan commented 8 months ago

Have you tried using backslashes \ instead of forward slashes /? I don't get any files found when using / on Windows, but I do with \ (which is the path separator on Windows)

mindplay-dk commented 8 months ago

Yes, I am doing that as a workaround.

I was intentionally doing it wrong here, just to demonstrate that it doesn't work cross-platform - a Linux person would have written it the way I did here, and then it wouldn't have worked on my Windows system.

You could of course type out [\\/] for every directory separator to make it cross-platform - but cross-platform portability shouldn't be a problem every individual project needs to consider and solve.