|Think about Loose Coupling|
You've noticed a problem, but are proposing the wrong solution.
The author wasn't being lazy, but overzealous.
The better solution is to simply skip the check of the filename completely.
Pass the filename supplied to the open function and let it detect and report the error.
This approach is portable because it lets the OS decide whether the string passed is valid.
The alternative is for every file handling routine to detect the current OS and then replicate all of the complex rules for filenames and paths for all systems; and that is a nonsense.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.