Bug fix B2013-086, The folder path part of _FileName contained a folder name with a perio resulting is an invalid file location/file name. Changed the IndexOf call to the LastIndexOf

This commit is contained in:
John Jenko 2013-04-26 12:24:08 +00:00
parent 1c689b3087
commit e25ba6d26e

View File

@ -125,11 +125,20 @@ namespace Volian.Print.Library
bool result = false;
string suffix = "";
int i = 0;
// just for safety, the while loop expects to find a file extension
// so make sure it has one before going into the loop
if (!_FileName.ToUpper().EndsWith(".PDF"))
_FileName += ".pdf";
// Try to open a file for creating the PDF.
while (result == false)
{
string fileName = _FileName;
int loc = fileName.IndexOf(".");
// Bug fix: B2013-086
// the folder path part of _FileName contained a folder name with a period
// resulting is an invalid file location/file name.
// Changed the IndexOf call to the LastIndexOf
//int loc = fileName.IndexOf(".");
int loc = fileName.LastIndexOf(".");
if (loc > -1)
{
string fname = fileName.Substring(0, loc);