8 ms·
Backslashes are valid characters in a POSIX filesystem, but they don't indicate a directory.
by bqe 8y ago
Backslashes are valid characters in a POSIX filesystem, but they don't indicate a directory.
- curun1r 8y agoYeah...rather than validating paths, the better use case is probably normalizing them so that you don't need platform-specific configuration files. Being able to write: static-files = path/to/static/files And have it work on all platforms gives a distinct advantage over specifying paths as strings.
- earenndil 8y agoThat was my first thought, but imo such a functionality belongs in the language's file access library.
- Stratoscope 8y agoEvery modern operating system accepts forward slash paths. It's been a long time since there was any need for things like Python's os.path.join() or special file path knowledge in config files to convert slashes to backlashes on Windows. You can just use forward slashes everywhere and not worry about it. The one exception on Windows may be paths in a CMD.EXE command line, where / may be confused for a switch character, but I would think a config file should not be passing paths on a command line but instead passing them directly into a program - and then the forward slash will work fine.