In some part of my code, I check if a file exists and then I open it.
One employee encountered a problem with filenames containing more than one space character.
I checked and it's true. Here's a snippet of my code:
string filePath = Path.Combine(helper.MillTestReportPath, fileName);
// Ouverture du fichier
if (File.Exists(filePath))
{
Process.Start(filePath);
}
else
{
MessageBox.Show("Le fichier n'existe pas!", "Fichier introuvable", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Everything works just find with almost every file but when a file ("SPAM CERTS S O 94318099 P O 10610.msg" for example) contains more than one space, I get false with File.Exists and even if I directly try to run Process.Start it fails...
Any idea about how I could fix that?
Thanks a lot!