BudgetAnalyser.DemoFileHelper.FindDemoFile C# (CSharp) Method

FindDemoFile() public method

public FindDemoFile ( ) : string
return string
        public string FindDemoFile()
        {
            string folder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            Debug.Assert(folder != null);
            for (var failsafe = 0; failsafe < 10; failsafe++)
            {
                string path = Path.Combine(folder, DemoFileName);
                if (FileExists(path))
                {
                    return path;
                }

                path = Path.Combine(folder, "TestData", DemoFileName);
                if (FileExists(path))
                {
                    return path;
                }

                folder = Directory.GetParent(folder).FullName;
            }

            throw new FileNotFoundException();
        }