Skip to content

Commit 7aa0476

Browse files
authored
Fix issue with relative paths (#161)
1 parent c73e5e7 commit 7aa0476

File tree

10 files changed

+58
-10
lines changed

10 files changed

+58
-10
lines changed

changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Changes
22

3+
27.7.21
4+
5+
Ensure that relative output directories work correctly.
6+
37
25.7.21
48

59
Add use of

src/MainUtils.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface
2828
MSEXCEL = 2;
2929
MSPOWERPOINT = 3;
3030

31-
DOCTO_VERSION = '1.5.34'; // dont us 05 - choco needs incrementing versions.
31+
DOCTO_VERSION = '1.6.41'; // dont us 0x - choco needs incrementing versions.
3232

3333
type
3434

@@ -873,7 +873,7 @@ procedure TDocumentConverter.LoadConfig(Params: TStrings);
873873
// tell file with no ext from dir.
874874
if (tmpext = '') then
875875
begin
876-
FOutputFile := IncludeTrailingBackslash(value);
876+
FOutputFile := IncludeTrailingBackslash(FOutputfile);
877877
OutputIsDir := true;
878878
OutputIsFile := false;
879879
ForceDirectories(FOutputFile);

src/WordUtils.pas

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function TWordDocConverter.ExecuteConversion(fileToConvert: String; OutputFilena
154154
except
155155
on E: Exception do
156156
begin
157-
// if ErroR contains EOleException The password is incorrect.
157+
// if Error contains EOleException The password is incorrect.
158158
// then it is password protected and should be skipped.
159159
if ContainsStr(E.Message, 'The password is incorrect' ) then
160160
begin
@@ -214,7 +214,8 @@ function TWordDocConverter.ExecuteConversion(fileToConvert: String; OutputFilena
214214

215215

216216
// If Word Options->Trust Center->Privacy Options-> "Warn before printing, saving or sending a file that contains tracked changes or comments"
217-
// is checked it will pop up a dialog on conversion. So we turn if off but reset it to origional value after.
217+
// is checked it will pop up a dialog on conversion. Makes not sense for a commandline util to have this set to true
218+
// So we turn if off but reset it to origional value after.
218219
WarnBeforeSavingPrintingSendingMarkup_Origional := WordApp.Options.WarnBeforeSavingPrintingSendingMarkup;
219220

220221
if WarnBeforeSavingPrintingSendingMarkup_Origional then
@@ -314,7 +315,7 @@ function TWordDocConverter.ExecuteConversion(fileToConvert: String; OutputFilena
314315
// loginfo('FileCreated: ' + OutputFilename, STANDARD);
315316
finally
316317

317-
// Reset it to origional value after.
318+
318319
if WarnBeforeSavingPrintingSendingMarkup_Origional then
319320
begin
320321
WordApp.Options.WarnBeforeSavingPrintingSendingMarkup := true;

src/docto.dproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,19 @@
243243
</PropertyGroup>
244244
<PropertyGroup Condition="'$(Cfg_3_Win32)'!=''">
245245
<VerInfo_MajorVer>1</VerInfo_MajorVer>
246-
<Debugger_RunParams>-wd -f &quot;D:\Development\GitHub\DocTo\test\Inputfiles\pie3.doc&quot; -o &quot;D:\Development\GitHub\DocTo\test\GeneratedFiles\Pie3.txt&quot; -T wdFormatText --Stdout -Q</Debugger_RunParams>
247-
<VerInfo_Build>58</VerInfo_Build>
246+
<Debugger_RunParams>-f &quot;.\Inputfiles\&quot; -o &quot;..\newdir2&quot; -T wdFormatRTF -l 10</Debugger_RunParams>
247+
<VerInfo_Build>59</VerInfo_Build>
248248
<VerInfo_PreRelease>false</VerInfo_PreRelease>
249249
<VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
250250
<VerInfo_AutoGenVersion>false</VerInfo_AutoGenVersion>
251251
<VerInfo_Release>32</VerInfo_Release>
252252
<Icon_MainIcon>docto_Icon2.ico</Icon_MainIcon>
253-
<VerInfo_Keys>CompanyName=Toflidium Software;FileDescription=DocTo - Convert doc files to any available format;FileVersion=1.4.32.58;InternalName=;LegalCopyright=Toby Allen;LegalTrademarks=;OriginalFilename=docto.exe;ProductName=DocTo;ProductVersion=1.3;Comments=https://github.com/tobya/DocTo;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
253+
<VerInfo_Keys>CompanyName=Toflidium Software;FileDescription=DocTo - Convert doc files to any available format;FileVersion=1.4.32.59;InternalName=;LegalCopyright=Toby Allen;LegalTrademarks=;OriginalFilename=docto.exe;ProductName=DocTo;ProductVersion=1.3;Comments=https://github.com/tobya/DocTo;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
254254
<DCC_ExeOutput>..\exe</DCC_ExeOutput>
255255
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
256256
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
257257
<VerInfo_MinorVer>4</VerInfo_MinorVer>
258+
<Debugger_CWD>D:\Development\GitHub\DocTo\test</Debugger_CWD>
258259
</PropertyGroup>
259260
<ItemGroup>
260261
<DelphiCompile Include="$(MainSource)">

src/docto.res

0 Bytes
Binary file not shown.

src/res/HelpLog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Long Parameters:
9494
use wdExportDocumentWithMarkup to export all word comments with pdf
9595

9696

97+
9798
Experimental:
9899
--skipdocswithtoc
99100
EXPERIMENTAL. Will skip any docs that contain a TOC to prevent hanging.
31 KB
Binary file not shown.

test/InputFiles/others/pres1.rtf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{\rtf1\ansi\ansicpg1252
2+
{\fonttbl
3+
{\f1\fnil\fcharset0\fprq0 Arial Black;}
4+
{\f2\fnil\fcharset0\fprq0 Times New Roman;}
5+
{\f3\fnil\fcharset0\fprq0 Arial;}
6+
}
7+
{\colortbl;
8+
\red204\green255\blue255;
9+
\red255\green255\blue255;
10+
\red0\green0\blue0;
11+
\red0\green0\blue255;
12+
}
13+
{\stylesheet
14+
{\s1\li540\fi-540\kerning24\shad\fs64\cf3\lang6153\level1 heading 1;}
15+
{\s2\li1170\fi-450\kerning24\shad\fs56\cf3\lang6153\level2 heading 2;}
16+
{\s3\li1800\fi-360\kerning24\shad\fs48\cf3\lang6153\level3 heading 3;}
17+
{\s4\li2520\fi-360\kerning24\shad\fs40\cf3\lang6153\level4 heading 4;}
18+
{\s5\li3240\fi-360\kerning24\shad\fs40\cf3\lang6153\level5 heading 5;}
19+
{\s6\li3960\fi-360\kerning24\cf3\lang6153\level6 heading 6;}
20+
{\s7\li4680\fi-360\kerning24\cf3\lang6153\level7 heading 7;}
21+
{\s8\li5400\fi-360\kerning24\cf3\lang6153\level8 heading 8;}
22+
{\s9\li6120\fi-360\kerning24\cf3\lang6153\level9 heading 9;}
23+
}
24+
\pard\plain\ltrpar\s1\li540\fi-540\kerning24\shad\fs64\cf3\lang6153\li0\fi0 {\shad\loch\f1\fs88\cf1\lang1033 \tab \par
25+
}\pard\plain\ltrpar\s2\li1170\fi-450\kerning24\shad\fs56\cf3\lang6153\li540\fi-540 {\pntext\pard\plain\shad\loch\f1\fs56 \'95\tab}{\*\pn\pnlvlblt\pnf1\pnfs56{\pntxtb \'95}}{\shad\loch\f1\cf2\lang2057 safasdfsadf}{\shad\loch\f1\cf2\lang1033 \par
26+
}\pard\plain\ltrpar\s2\li1170\fi-450\kerning24\shad\fs56\cf3\lang6153\li540\fi-540 {\pntext\pard\plain\shad\loch\f1\fs56 \'95\tab}{\*\pn\pnlvlblt\pnf1\pnfs56{\pntxtb \'95}}{\shad\loch\f1\cf2\lang2057 asdfsadfsadf}{\shad\loch\f1\cf2\lang1033 \par
27+
}\pard\plain\ltrpar\s1\li540\fi-540\kerning24\shad\fs64\cf3\lang6153 {\shad\f3 \par
28+
}\pard\plain\ltrpar\s2\li1170\fi-450\kerning24\shad\fs56\cf3\lang6153\li540\fi-540 {\pntext\pard\plain\shad\loch\f1\fs56 \'95\tab}{\*\pn\pnlvlblt\pnf1\pnfs56{\pntxtb \'95}}{\shad\loch\f1\cf2\lang2057 Asdfasdfsdsdf\par
29+
}\pard\plain\ltrpar\s2\li1170\fi-450\kerning24\shad\fs56\cf3\lang6153\li540\fi-540 {\shad\loch\f1\cf2\lang2057 \par
30+
}\pard\plain\ltrpar\s2\li1170\fi-450\kerning24\shad\fs56\cf3\lang6153\li540\fi-540 {\pntext\pard\plain\shad\loch\f1\fs56 \'95\tab}{\*\pn\pnlvlblt\pnf1\pnfs56{\pntxtb \'95}}{\shad\loch\f1\cf2\lang2057 Soooooper}{\shad\loch\f1\cf2\lang1033 \par
31+
}
32+
}

test/testrelative.bat

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
REM If output Dir left out default to input
22
REM copy ".\Inputfiles\pie3.doc" ".\GeneratedFiles\PieNoOutputTest.doc"
33
REM Try on Single
4-
"../exe/docto.exe" -f ".\Inputfiles\pie3.doc" -o ".\GeneratedFiles\Pie3Single.rtf" -T wdFormatRTF -l 10
4+
"../exe/docto.exe" -f ".\Inputfiles\pie3.doc" -o ".\GeneratedFiles\\Pie3Single.rtf" -T wdFormatRTF -l 10
5+
6+
"../exe/docto.exe" -f ".\Inputfiles\pie3.doc" -o "..\test\GeneratedFiles234\Pie3Single.rtf" -T wdFormatRTF -l 10
7+
8+
"../exe/docto.exe" -f ".\Inputfiles\pie3.doc" -o "..\test\Generatednewdir\Pie3Single.rtf" -T wdFormatRTF -l 10
9+
10+
11+
"../exe/docto.exe" -f ".\Inputfiles\" -o "..\test\Generatednewdir2" -T wdFormatRTF -l 10

test/testxls_relative.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
REM Load xls from a relative path and convert to csv
2-
"../exe/docto.exe" -XL -f "inputfilesxl\Week 1 Test.xls" -o "GeneratedFiles\Week1.csv" -T xlCSV -l 10
2+
"../exe/docto.exe" -XL -f "inputfilesxl\Week 1 Test.xls" -o "GeneratedFiles\Week1.csv" -T xlCSV -l 10
3+
4+
"../exe/docto.exe" -XL -f "inputfilesxl\" -o "..\Test\GeneratedTestputFiles/Week3" -T xlCSV -l 10

0 commit comments

Comments
 (0)