View Issue Details

IDProjectCategoryView StatusLast Update
0038364FPCDocumentationpublic2021-02-11 11:54
ReporterMarco van de Voort Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionopen 
Summary0038364: $unitpath documentation
DescriptionThe unitpath directory doesn't document what is the root of relative paths in the $unitpath directive, even
though it recommends relative paths

https://www.freepascal.org/docs-html/prog/progsu120.html

Logical options are (1) current directory, (2) directory where the unit is that is being compiled.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Marco van de Voort

2021-02-11 10:37

manager   ~0128883

Same thing for paths in source like

uses x in '/a/b/c/y.pas';

Michael Van Canneyt

2021-02-11 10:45

administrator   ~0128884

Do you know what the root is ?

Marco van de Voort

2021-02-11 11:44

manager   ~0128887

No, I haven't checked. I just noticed that both features come up a lot in unexpected "unit not found" problems. I don't know what Delphi does ( USES..IN construct) and what the intention behind these were.

The problem with using the current directory rather than the source file as root is that when a unit with such construct gets implicitly compiled, the root is different. In that case these constructs should probably be limited to library or program modules.

Marco van de Voort

2021-02-11 11:54

manager   ~0128888

It seems $unitpath is relative to module source:

(scandir.pp:1540 and thereabouts)

            if (current_module.path<>'') and
               not path_absolute(unitpath) then
             unitpath:=current_module.path+source_info.DirSep+unitpath;

The IN case I can't read as easily from the source, and has Delphi compatibility concerns (which I also don;'t know)

Issue History

Date Modified Username Field Change
2021-01-16 21:25 Marco van de Voort New Issue
2021-01-16 21:25 Marco van de Voort Status new => assigned
2021-01-16 21:25 Marco van de Voort Assigned To => Michael Van Canneyt
2021-01-19 11:21 Marco van de Voort Description Updated View Revisions
2021-01-19 11:21 Marco van de Voort FPCTarget => -
2021-02-11 10:37 Marco van de Voort Note Added: 0128883
2021-02-11 10:45 Michael Van Canneyt Note Added: 0128884
2021-02-11 11:44 Marco van de Voort Note Added: 0128887
2021-02-11 11:54 Marco van de Voort Note Added: 0128888