Skip to content

Commit 30e508f

Browse files
Docs: More
1 parent dc97163 commit 30e508f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ the files, so it is not able to report which values are different.
3636

3737
### Compare two directories
3838

39-
If one wants to compare two directories with the following structures:
39+
Let's compare two directories with the following structures:
4040

4141
```bash
4242
└── reference_dir
@@ -55,6 +55,9 @@ If one wants to compare two directories with the following structures:
5555
└── file_1.c
5656
```
5757

58+
The `reference` directory contains all the files that should be checked in the `compared` directory,
59+
which means that extraneous files in the `compared` directory are just ignored.
60+
5861
These two directories can be compared with the following code:
5962

6063
```python
@@ -63,10 +66,15 @@ import dir_content_diff
6366
dir_content_diff.compare_trees("reference_dir", "compared_dir")
6467
```
6568

69+
> [!WARNING]
70+
> The order of the parameters is important: the first path is considered as the `reference`
71+
> directory while the second one is the `compared` directory. Inverting the parameters way return
72+
> a different result (in this example it would return that the file `sub_file_3.b` is missing).
73+
6674
If all the files are identical, this code will return an empty dictionary because no difference
67-
was detected. This is because `dir-content-diff` is only looking for files in the compared directory
68-
that are also present in the reference directory. Thus extraneous files from the compared directory
69-
are not considered.
75+
was detected. As pointed previously, this is because `dir-content-diff` is only looking for files
76+
in the compared directory that are also present in the reference directory, so the file
77+
`sub_file_3.b` is just ignored in this case.
7078

7179
If ``reference_dir/file_1.c`` is the following JSON-like file:
7280

0 commit comments

Comments
 (0)