tl;dr question:
What is the actual algorithm doxygen uses to find images referenced to in doxygen comments? And the corollary, what's considered best practice which won't break in future doxygen versions?
Details:
We're trying to institute a policy where any images associated with doxygen comments should be localized to the reference, which means we'll have images distributed throughout the source tree. Obviously, we need to make sure that we refer to the images appropriately and that doxygen can find them to produce the correct documentation.
The doxygen documentation states:
doxygen will look for files in the paths (or files) that you specified after the IMAGE_PATH tag
However, in my tinkering I've come to the conclusion that this doesn't seem strictly correct. Here are some experimental results:
================================================
Experiment
File system configuration:
/full/
path/
doxygen.cfg
to/
this/
header.h
images/
image.png
other/
images/
image.png
The doxygen config file is in the "root" of the tree (i.e., /full/path/) and doxygen is executed from this same folder.header.h references images/image.png located in the same tree (/full/path/to/this). There is an identically named image file located elsewhere in the tree. header.h has the line:
@file html [filename]
reference where [filename] is one of the following:
image.pngimages/image.png./images/image.png/full/path/to/this/images/image.png
Then I play with the IMAGE_PATH variable.
Case 1:IMAGE_PATH = (i.e., no path defined).
- "Wrong" image loaded (other/iamges/image.png)
- no image
- no image
- Correct image loaded
Case 2: IMAGE_PATH = /full/path (path provided to root, but not full path to header file).
- Correct image loaded
- Correct image loaded
- Correct image loaded
- Correct image loaded
Case 3: IMAGE_PATH = /full/path/other (path provided to root which does not include the header file).
- "Wrong" image loaded (other/iamges/image.png)
- "Wrong" image loaded (other/iamges/image.png)
- "Wrong" image loaded (other/iamges/image.png)
- Correct image loaded
================================================
Inferred Algorithm Properties
- Relative paths only work if the relative path is in the tree rooted in a path specified in
IMAGE_PATH. - In the case where the image file name can resolve into different images, doxygen appears to pick the one "closest" to the reference.