Skip to content

Commit e4ceda2

Browse files
author
DelphiDabbler
committed
Merge branch 'release/2.0'
2 parents ff663cf + 32e1faa commit e4ceda2

15 files changed

Lines changed: 715 additions & 226 deletions

Build.txt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CompFileDate Build Instructions
22
===============================
33

4-
These instructions assume you are building the program using Delphi 2010. Later
4+
These instructions assume you are building the program using Delphi XE. Later
55
versions of Delphi may be suitable with some minor changes to the make file.
66

77

@@ -16,7 +16,7 @@ Build Tools
1616

1717
The following tools are required to build the program:
1818

19-
+ A Delphi 2010 or later installation. The following tools are required:
19+
+ A Delphi XE or later installation. The following tools are required:
2020
- `DCC32.exe` command line compiler.
2121
- `BRCC32.exe` resource compiler.
2222
- `MAKE.exe` the Borland / Embarcaero make utility (other make tools will not
@@ -29,27 +29,24 @@ The following tools are required to build the program:
2929
Environment Variables
3030
---------------------
3131

32-
The program's make file requires that the following environment variables must
33-
be set:
32+
The make file uses the following environment variables, which should be set
33+
before calling Make, or defined on the Make command line:
3434

3535
+ `DELPHIROOT` - should be set to the install directory of the version of Delphi
3636
being used. If not set it is assumed that Delphi is installed in the same
3737
directory as `MAKE.exe`.
3838
+ `VIEDROOT` - set to the install directory of `VIEd.exe`. If not set then
39-
`VIEd.exe` is assumed to by on the path.
39+
`VIEd.exe` is assumed to be on the path.
4040

4141

4242
Download the Source
4343
-------------------
4444

45-
Source code for the current version of DelphiDabbler CompFileDate is always
46-
available from http://www.delphidabbler.com/download?id=compfiledate&type=src
47-
and from the Git repository at
48-
https://sourceforge.net/p/compfiledate/git/ci/master/tree/
45+
The program's source code is maintained in the delphidabbler/compfiledate Git
46+
repository on GitHub. See https://github.com/delphidabbler/compfiledate
4947

50-
To build the program first create a folder and copy the source code from the
51-
download file or from Git into it, preserving the directory structure so that
52-
you have the following:
48+
Either clone or fork the repo into a directory on your computer. The following
49+
directory structure will be created within your nominated directory:
5350

5451
.
5552
|
@@ -77,7 +74,7 @@ The program can now be created simply by running `Make` with no parameters.
7774
Intermediate binary files will be placed in `Build\Bin` and the program
7875
executable will be written to `Build\Exe`.
7976

80-
To create an release run `Make release` after running `Make`. This creates two
77+
To create a release run `Make release` after running `Make`. This creates two
8178
zip files, one containing the executable code and the other the source code. The
8279
zip files are placed in the `Build\Release` directory.
8380

@@ -93,6 +90,14 @@ There are other build options available. See the comments in `Makefile` for
9390
details.
9491

9592

93+
Contributing
94+
------------
95+
96+
Contributions are welcome. Please fork the GitHub repo and create a new feature
97+
branch off the `development` branch. Commit your changes to the feature branch.
98+
When ready create a pull request on the main GitHub repo.
99+
100+
96101
Licensing
97102
---------
98103

Docs/ChangeLog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Release v2.0.0 of 20 July 2014
2+
+ Operator used in date comparison can now be specified using new --compare or -c commands. This enables user to choose whether date of 1st file is tested to be <, <=, >, >=, <> or = to date of second file. [issue #1]
3+
+ Comparison can now operate on either creation or last modification date of files. This is specified with new --datetype or -d commands. [issue #2]
4+
+ When comparing the dates of shortcut files the date of the shortcut's target file can now be compared by using the new --followshortcuts or -s commands. [issue #3]
5+
+ Program version number can now be displayed using the new --version or -V commands. Version is no longer displayed in normal program output. [issue #5]
6+
+ Long forms of -v and -h commands added: --verbose and --help respectively. [issue #4]
7+
+ Help screen revised re changes.
8+
+ Now compiled with Delphi XE.
9+
+ Updated and rationalised documentation re changes.
10+
111
Release v1.0.1 of 24 March 2014
212
+ Changed to use Unicode strings internally and to convert them to local ANSI encoding before output.
313
+ Fixed typo in help screen.

Docs/ReadMe.txt

Lines changed: 78 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,78 @@ About The Program
66
-----------------
77

88
CompFileDate.exe compares the dates of two files whose names are passed on the
9-
command line and returns an exit code that informs if the first named file has
10-
an older modification date than the second file.
9+
command line and returns an exit code that indicates the result.
1110

1211
The usage is:
1312

14-
CompFileDate <filename1> <filename2> [-v]
15-
16-
or:
17-
18-
CompFileDate -h | -?
19-
20-
where:
21-
22-
* `<filename1>` is the name of the first file to be compared.
23-
* `<filename2>` is the name of the second file to be compared.
24-
* `-v` causes the program to emit output to the console's standard output. If
25-
this switch is not specified the program emits no output, unless an error is
26-
detected when the switch is ignored.
27-
* `-h` or `-?` displays a help screen on standard output.
28-
29-
Exit codes are:
30-
31-
* `0` - `<filename1>` is newer than, or has the same date as `<filename2>`.
32-
* `1` - `<filename1>` is older than `<filename2>`.
33-
* `100` - Unknown error detected.
34-
* `101` - An invalid switch was supplied.
35-
* `102` - Incorrect number of file names supplied.
36-
* `103` - Both file names were the same.
37-
* `104` - Date information couldn't be read from one or both files. It is
38-
possible that a file doesn't exist.
13+
CompFileDate <filename1> <filename2> [options]
14+
CompFileDate -h | -? | --help
15+
CompFileDate -V | --version
16+
17+
18+
where
19+
20+
<filename1> is the name of the first file to be compared.
21+
<filename2> is the name of the second file to be compared.
22+
23+
options are:
24+
25+
-c <op> or --compare=<op>
26+
Defines the compare operation to use. <op> must be one of the following:
27+
eq, equal, same:
28+
Check if the dates of the files are the same.
29+
gt, newer, later:
30+
Check if the 1st file date is later than the 2nd file date.
31+
gte, not-older, not-earlier
32+
Check if the 1st file date is no earlier than the 2nd file date.
33+
lt, older, earlier
34+
Check if the 1st file date is earlier than the 2nd file date (default
35+
used if this option is not provided).
36+
lte, not-newer, not-later
37+
Check if the 1st file date is no later than the 2nd file date.
38+
neq, not-equal, not-same, different
39+
Check if the dates of the files are different.
40+
41+
-d <type> or --datetype=<type>
42+
Determines whether the last modification or creation dates of the files are
43+
compared. <type> must be one of the following:
44+
m, modified, last-modified, modification:
45+
Use the date the files were last modified (default used if the option is
46+
not provided).
47+
c, created, creation:
48+
Use the date the files were created.
49+
50+
-s or --followshortcuts
51+
Indicates that if either filename1 or filename2 is a shortcut file then the
52+
date of the shortcut's target file will be used in comparisons. If neither
53+
option is specified then shortcuts are not followed and the date of the
54+
shortcut file itself is used in the comparison.
55+
56+
-v or --verbose
57+
Verbose: writes output to standard output. No output is generated if this
58+
option is not provided. Output is always written when an error occurs or
59+
when help or the program's version number are requested.
60+
61+
-h or -? or --help
62+
Displays a help screen. Any file names and other options are ignored.
63+
64+
-V or --version.
65+
Displays the program's version number on standard output and halts. Any file
66+
names and other options are ignored.
67+
68+
The program's exit code is 1 if the comparison is true and 0 if it is false.
69+
If an error occurs then an error code >= 100 is returned and an error message
70+
is written to standard output. The error codes are:
71+
72+
100 - unknown error
73+
101 - invalid command or option
74+
102 - incorrect number of files specified (two required)
75+
103 - both file names are the same
76+
104 - one or both files cannot be found
77+
105 - no comparison type was specified for the -c or --compare option
78+
106 - an invalid comparison type was specified for the -c or --compare option
79+
107 - no date type was specified for the -t or --datetype option
80+
108 - an invalid date type was specified for the -t or --datetype option
3981

4082

4183
Installation
@@ -47,14 +89,14 @@ installation is required.
4789
You may want to modify the Windows PATH environment variable to include the
4890
location of the program.
4991

50-
To uninstall simply delete the program. They make no changes to the system.
92+
To uninstall simply delete the program. It makes no changes to the system.
5193

5294

5395
Source Code
5496
-----------
5597

56-
Source code for much of the program is available from
57-
http://www.delphidabbler.com/compfiledate/download.
98+
The program's source code is available on GitHub. See delphidabbler/compfiledate
99+
at https://github.com/delphidabbler/compfiledate
58100

59101

60102
Copyright and License
@@ -69,3 +111,9 @@ Change Log
69111

70112
The change log is provided in the file `ChangeLog.txt` provided with this
71113
download.
114+
115+
116+
Web page
117+
--------
118+
119+
The program has a web page at http://www.delphidabbler.com/software/compfiledate

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
File Date Comparison Utility
22
============================
33

4-
CompFileDate is a simple command line utility for Windows that compares the modification dates of two files whose names are passed on the command line and returns an exit code that informs if the first named file has an earlier modification date than the second file.
4+
CompFileDate is a command line utility for Windows that compares the dates of two files whose names are passed on the command line and returns an exit code that indicates the result.
55

66
Usage
77
-----
88

9-
CompFileDate <filename1> <filename2> [-v]
9+
For a full explanation of how to use the program see [`ReadMe.txt`](Docs/ReadMe.txt).
1010

11-
where `<filename1>` and `<filename2>` are the names of the files to compare. `0` is returned if `<filename1>` is newer than, or has the same date as `<filename2>` and `1` is returned if `<filename1>` is older than `<filename2>`. An error code >= 100 indicates an error: see Docs\ReadMe.txt for details.
11+
You can also view a help screen from within CompFileDate by using the command:
1212

13-
Unless there is an error CompFileDate normally produces no output. To get the result of the comparison written to standard output specify the `-v` command.
14-
15-
To get help use:
16-
17-
CompFileDate -?
13+
CompFileDate -h
1814

1915
Contributions
2016
-------------
2117

22-
It's only a little utility, but any improvements are welcome. Just fork the repo
23-
(the development branch is best), create a feature branch and submit a pull
24-
request with your changes.
18+
It's only a little utility, but any improvements are welcome. Just fork the repo and create a feature branch off the `development` branch. Commit your changes to the feature branch then submit a pull request when ready.
2519

2620
License
2721
-------
2822

29-
Licensed under the [Mozilla Public License v2.0](http://www.mozilla.org/MPL/2.0/).
23+
Licensed under the [Mozilla Public License v2.0](http://www.mozilla.org/MPL/2.0/).

Src/CompFileDate.dpr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ uses
2222
UConsole in 'UConsole.pas',
2323
UMain in 'UMain.pas',
2424
UParams in 'UParams.pas',
25-
UStdOutput in 'UStdOutput.pas';
25+
UStdOutput in 'UStdOutput.pas',
26+
UDateComparer in 'UDateComparer.pas',
27+
UDateExtractor in 'UDateExtractor.pas',
28+
UFileInfo in 'UFileInfo.pas';
2629

2730
begin
2831
with TMain.Create do

Src/CompFileDate.dproj

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
<MainSource>CompFileDate.dpr</MainSource>
55
<Config Condition="'$(Config)'==''">Base</Config>
66
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
7-
<ProjectVersion>12.0</ProjectVersion>
7+
<ProjectVersion>12.3</ProjectVersion>
8+
<Base>True</Base>
9+
<Platform>Win32</Platform>
10+
<AppType>Console</AppType>
11+
<FrameworkType>None</FrameworkType>
812
</PropertyGroup>
913
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
1014
<Base>true</Base>
1115
</PropertyGroup>
1216
<PropertyGroup Condition="'$(Base)'!=''">
17+
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
1318
<DCC_CVT_WIDENING_STRING_LOST>true</DCC_CVT_WIDENING_STRING_LOST>
1419
<DCC_EXPLICIT_STRING_CAST_LOSS>true</DCC_EXPLICIT_STRING_CAST_LOSS>
1520
<DCC_Description>File Date Comparison Utility</DCC_Description>
@@ -40,11 +45,15 @@
4045
<DCCReference Include="UMain.pas"/>
4146
<DCCReference Include="UParams.pas"/>
4247
<DCCReference Include="UStdOutput.pas"/>
48+
<DCCReference Include="UDateComparer.pas"/>
49+
<DCCReference Include="UDateExtractor.pas"/>
50+
<DCCReference Include="UFileInfo.pas"/>
4351
<BuildConfiguration Include="Base">
4452
<Key>Base</Key>
4553
</BuildConfiguration>
4654
</ItemGroup>
47-
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
55+
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
56+
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
4857
<ProjectExtensions>
4958
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
5059
<Borland.ProjectType/>
@@ -53,11 +62,7 @@
5362
<Source>
5463
<Source Name="MainSource">CompFileDate.dpr</Source>
5564
</Source>
56-
<Parameters>
57-
<Parameters Name="UseLauncher">False</Parameters>
58-
<Parameters Name="LoadAllSymbols">True</Parameters>
59-
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
60-
</Parameters>
65+
<Parameters/>
6166
<VersionInfo>
6267
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
6368
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
@@ -86,6 +91,9 @@
8691
<VersionInfoKeys Name="Comments"/>
8792
</VersionInfoKeys>
8893
</Delphi.Personality>
94+
<Platforms>
95+
<Platform value="Win32">True</Platform>
96+
</Platforms>
8997
</BorlandProject>
9098
<ProjectFileVersion>12</ProjectFileVersion>
9199
</ProjectExtensions>

Src/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737

3838

3939
# DELPHIROOT must point to the install directory for the version of Delphi being
40-
# used to compile the program. NOTE: The program is targeted at Delphi 2010 but
40+
# used to compile the program. NOTE: The program is targeted at Delphi XE but
4141
# later compilers should be suitable with only minor changes.
4242
!ifndef DELPHIROOT
4343
# DELPHIROOT not set: make a guess
4444
DELPHIROOT = $(MAKEDIR)\..
4545
!endif
4646

4747
# Define macros that access required programs
48-
# DCC32 and BRCC32 should be in same sub-directory of Delphi 2010
48+
# DCC32 and BRCC32 should be in same sub-directory of Delphi XE
4949
DCC32 = "$(DELPHIROOT)\Bin\DCC32.exe"
5050
BRCC32 = "$(DELPHIROOT)\Bin\BRCC32.exe"
5151
# VIED is expected to be on the path or its install directory must be specified
@@ -94,7 +94,7 @@ clean:
9494
-@cd Src
9595
@echo Done.
9696

97-
# Create executable and source released zip files
97+
# Create executable and source release zip files
9898
release: clean releaseexe releasesrc
9999

100100
# Create release zip file for executable
@@ -154,7 +154,7 @@ config:
154154
@echo +++ Compiling Resource file $< +++
155155
@$(BRCC32) $< -fo$(RESOUTDIR)\$(@F)
156156

157-
# Version info filea are compiled by VIEd: a temporary .rc file is left behind
157+
# Version info files are compiled by VIEd: a temporary .rc file is left behind
158158
.vi.rc:
159159
@echo +++ Compiling Version Info file $< +++
160160
@$(VIED) .\$<

0 commit comments

Comments
 (0)