diff --git a/src/MainUtils.pas b/src/MainUtils.pas index 3e6caf5..16f4540 100644 --- a/src/MainUtils.pas +++ b/src/MainUtils.pas @@ -576,11 +576,11 @@ function TDocumentConverter.Execute: string; if not DoExecute then HaltWithError(201, 'Input File, Output File and FileFormat must all be specified'); // Set Output Filename if Dir Provided. - if (InputIsFile and OutputIsDir) then + if ( OutputIsDir) then begin if OutputExt = '' then begin - OutputExt := '.' + FormatsExtensions.Values[OutputFileFormatString]; + OutputExt := '.' + FormatsExtensions.Values[OutputFileFormatString]; loginfo('Output Extension is ' + outputExt, CHATTY); end; @@ -649,6 +649,7 @@ function TDocumentConverter.Execute: string; StartTime := GettickCount(); logdebug('Executing Conversion ... ',VERBOSE); + logdebug('Executing Conversion ... ' + FileToCreate,VERBOSE); ConversionInfo := ExecuteConversion(FileToConvert, FileToCreate, OutputFileFormat); if ConversionInfo.Successful then @@ -665,11 +666,14 @@ function TDocumentConverter.Execute: string; // Check if file needs to be deleted. if RemoveFileOnConvert then begin - // Check file exists and Delete if requested - if FileExists(FileToCreate) then + // Check file has been converted and Delete if requested + if FileExists(ConversionInfo.OutputFile) then begin - DeleteFile(FileToConvert); - Loginfo('Deleted:' + FileToConvert,STANDARD); + if FileExists(ConversionInfo.InputFile) then + begin + DeleteFile(ConversionInfo.InputFile); + Loginfo('Deleted:' + ConversionInfo.InputFile,STANDARD); + end; end; end; diff --git a/src/docto.dproj b/src/docto.dproj index 4f84712..fb6a872 100644 --- a/src/docto.dproj +++ b/src/docto.dproj @@ -219,13 +219,13 @@ false true false - 41 + 42 docto_Icon2.ico - CompanyName=Toflidium Software;FileDescription=DocTo - Convert doc files to any available format;FileVersion=1.9.41.69;InternalName=;LegalCopyright=Toby Allen;LegalTrademarks=;OriginalFilename=docto.exe;ProductName=DocTo;ProductVersion=1.6;Comments=https://github.com/tobya/DocTo;ProgramID=com.embarcadero.$(MSBuildProjectName) + CompanyName=Toflidium Software;FileDescription=DocTo - Convert doc files to any available format;FileVersion=1.10.42.69;InternalName=;LegalCopyright=Toby Allen;LegalTrademarks=;OriginalFilename=docto.exe;ProductName=DocTo;ProductVersion=1.6;Comments=https://github.com/tobya/DocTo;ProgramID=com.embarcadero.$(MSBuildProjectName) ..\exe $(BDS)\bin\default_app.manifest true - 9 + 10 1