Michael Van Canneyt wrote:
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.
This will fail if the file is located on some smb or nfs mount.
Marc
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal