[fpc-pascal] Function for checking correct file name

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Sep 14 17:42:21 CEST 2012


Am 2012-09-12 20:51, schrieb Krzysztof:
> Exists any multiplatform function which check if string contains not
> allowed characters (like < > / \ on windows) for filename?
>
The question is: Do you realy need it?

I came to the conclusion that it's very hard to determine what exactly is a valid file name
and that it is much easier, safer, platform independend and more future proof to just try
creating a file with the name. If it fails, you can check the error result for the reason.

And even if the file name is valid it does not prevent you from error checking because
other obstacles like missing rights can also prevent you from using the file(path) name.




More information about the fpc-pascal mailing list