You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows file paths can use the forward or back slashes to indicate section. The way this is handled in Python is to convert all of the backslashes to forward slashes and then try to match on that. This approach should work for this library as well since we can just check if the code is running on Windows and then make the necessary substitutions.
Another thing that could be done would be to change the pattern generated by the main globlin library to match either forward or back slashes. I don't really want to do it that way since I don't think adding handling for that to globlin really makes sense right now. The main thing that would change my mind would be performance concerns.
I had it backwards. All forwards slashes are converted to backslashes. This is fine but would mean converting the regex as well which is a pain. I wonder if doing the opposite would work here. Both the forward and back slashes are considered path component separators on Windows so as long as I only convert the original path to string to match things everything should be fine, right? It would likely be slower on Windows as a result though.
For reference, this is the os.path.normcase method I'm referring to.
I think the main thing is the the globlin_fs.glob_from method would need to get the current platform os and then pass that information into the globlin_fs.collect_files method. After the path is created the backlashes would be converted to forward slashes only on Windows and then the original paths would be returned.
Windows file paths can use the forward or back slashes to indicate section. The way this is handled in Python is to convert all of the backslashes to forward slashes and then try to match on that. This approach should work for this library as well since we can just check if the code is running on Windows and then make the necessary substitutions.
Another thing that could be done would be to change the pattern generated by the main
globlin
library to match either forward or back slashes. I don't really want to do it that way since I don't think adding handling for that togloblin
really makes sense right now. The main thing that would change my mind would be performance concerns.The new https://github.com/ditherwither/platform could be used to find out if the user is on Windows.
The text was updated successfully, but these errors were encountered: