On Wed, 26 Mar 2014, Mattias Gaertner wrote:
On Wed, 26 Mar 2014 15:33:38 +0100 (CET)
Michael Van Canneyt <mich...@freepascal.org> wrote:
[...]
So ? You just need to check the inode.
Is there a function to list all files pointing to an inode?
Actually, you just need to know if 2 filenames point to the same inode.
And what 2 files should I check? There are thousands of files in
the search path.
To avoid duplicates, only the files that are already open in the IDE must be
checked.
For the others, it is irrelevant how you opened them.
There are 2 scenarios:
1. A file with a similar name (filename part matches) is already open in the
IDE.
If you collect the inode when opening, there is no problem (I'm guessing you
already do a stat on open.
2. No such file is opened:
You can open it using whatever path.
The next time a file must be opened, you check the file at the 'locical' location,
and if its inode matches an opened file, you know it is open already.
IMO we can shorten this: Going from logical to physical is easy,
going back is more difficult. It is more complicated than just checking
the inode. Especially if you want to do that on all thousands of
messages from the compiler. That's an implementation detail and
off-topic.
[...]
? it IS the right file. It is the SAME file, after all.
We could make a poll. I guess the majority expects that when the
IDE compiles /tmp/link/project1.pas then it should
work with /tmp/link/uni1.pas, not /somewhereelse/unit1.pas.
I certainly don't, but I guess we differ in our view.
See my other mail.
So, you would be happy, if the IDE opens /tmp/orig/unit1.pas instead
of /tmp/link/unit1.pas?
Absolutely.
The only reason I would use a symlink is to avoid traversing N levels of
directory.
It is the end result that matters.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal