ArgumentException, path is a zero-length string, contains only white space, or contains one or more of the invalid characters defined in GetInvalidPathChars.
The array returned from this method is not guaranteed to contain the complete set of characters that are invalid in file and directory names. The full set of invalid characters can vary by file system. For example, on Windows-based desktop platforms, invalid path characters might include ASCII/Unicode characters 1 through 31, as well as quote ("), less than (<), greater than (>), pipe (|), backspace (\b), null (\0) and tab (\t).
cs_Bidou
Messages postés5487Date d'inscriptiondimanche 4 août 2002StatutMembreDernière intervention20 juin 201361 9 oct. 2008 à 20:47
Un path ne se donne pas avec des guillemets généralement, non? Il ne s'agit donc pas vraiment de réinventer la roue...
Tu peux faire passer ton string dans une Regex pour nettoyer ce qu'il faut et ensuite tu envoyes à la fonction GetFullPath.
Pour le premier, tout est bon avec les appels :
string strFileName = System.IO.Path.GetFileName(FullPath);
string strArgs = System.IO.Path.GetExtension(FullPath);
System.IO.Path.GetDirectoryName(FullPath);
System.IO.Path.GetPathRoot(FullPath);
et un peu de traitement interne.
Pour le second tableau, tout est foireux.
Allez, on s'y met une bonne fois pour toute et je pose la source complète ;p