Debug Statement Doesn't Work?

Hi guys, I’ve got this code

                    string filePath = PlayerPrefs.GetString("Igloo Install Location") + "\\IglooWarper";
                    if (File.Exists(filePath))
                    {
                        UnityEngine.Debug.Log(filePath);
                    }

                    Process.Start(PlayerPrefs.GetString("Igloo Install Location") + "\\IglooWarper"); //Needs the full file path to launch; defined in registry.

The Process.Start line works fine, but the lines above, with the Debug statement won’t get hit. It fires if !File.Exists but I know that it does, obviously, because it’s launching.

using system.IO;

Any ideas? Thanks.

Most likely because “IglooWarper” is not a valid file name. If it’s an executable file the full file name is “IglooWarper.exe”. Starting a process goes through the OS shell which will resolve the path of the file automatically. However “File.Exists” only checks valid file names. You could have several files with the same name but different extensions. Though the extension is part of the filename. So if you have the files:

IglooWarper.exe
IglooWarper.txt
IglooWarper.doc

If you ask if “IglooWarper” exists this can’t be answered with “yes” since there is no file without extension. However if the OS should start a process named “IglooWarper” it first tries to run “IglooWarper” (which will fail) and then it assumes “IglooWarper.exe”. So working with files and starting a process are two different things.

I was using the wrong file path.