Hacker News new | ask | show | jobs
by james412 2115 days ago
> filename should be a dumb blob of bytes

This hasn't been true since the days of CP/M

1 comments

For e.g. the Linux kernel, besides path separator(s), why do you think that?

All of the wide/special-case manipulation when writing code on e.g. Windows drove me nuts.

Out of interest, what special-case manipulation? I generally treat file paths as opaque `\` separated strings (or even as a single blob if I don't need to parse it). I'm uncertain why I'd want to treat them specially. I'll leave that to the OS.
Take for example a file on NTFS.. the filenames can be UTF-16 (they support 16 bit chars under the hood).. but they also might not be valid UTF-16. When you access the file by the filename, you now have the potential to use all of the wide function calls (e.g. _wfopen) or the the ansi versions (e.g. fopen).