[fpc-pascal] Function for checking correct file name

Vinzent Höfler JeLlyFish.software at gmx.net
Fri Sep 14 19:02:52 CEST 2012


On Fri, 14 Sep 2012 18:53:53 +0200, Krzysztof <dibo20 at wp.pl> wrote:

> I need only basic checking, it not need to be 100% compability with OS
> specification. My program asking user for playlist name and I'm saving
> it in local folder with my own extension.

Then for von Neumanns sake simply try to save it where the user asks you to
and if any error occurs, tell the user.

I mean, there are hundreds of reasons why a file write may fail, why bother
with trying to prevent just one of them? Especially because this hugely
differs between different platforms.

You still have to do error handling anyway, and IMO the user is entitled to
name his own files any way he likes - as long as the operating system  
accepts
it. But after all, the choice of operating system was his, so the blame  
goes
to someone else, not you who prevented the user to create a playlist called
"100% Ginuwine" (yes, I googled).


Vinzent.

-- 
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We cause accidents.
     -- Nathaniel Borenstein



More information about the fpc-pascal mailing list