Bloom.Publish.PublishModel.GetPdfPath C# (CSharp) Method

GetPdfPath() private method

private GetPdfPath ( string fname ) : string
fname string
return string
        private string GetPdfPath(string fname)
        {
            string path = null;

            // Sanitize fileName first
            string fileName = SanitizeFileName(fname);

            for (int i = 0; i < 100; i++)
            {
                path = Path.Combine(Path.GetTempPath(), string.Format("{0}-{1}.pdf", fileName, i));
                if (!RobustFile.Exists(path))
                    break;

                try
                {
                    RobustFile.Delete(path);
                    break;
                }
                catch (Exception)
                {
                    //couldn't delete it? then increment the suffix and try again
                }
            }
            return path;
        }