W
withtape
Hello all,
I am writing an application that will track data about files. Once the
application becomes aware of a particular file, I would like to add a
feature whereby, even if the nominal pathname has changed, it is still
able to locate the file. I have thought of a few ways one might do
this:
1) Have the program run a thread that constantly watches each known
file. Not only is this inefficient, it also feels dirty; but it would
get the job done in a cross-platform way.
2) Make use of operating sytem APIs that implement this kind of
behavior. For example, the Windows Shell API provides for "copy hook
handlers" (http://msdn2.microsoft.com/en-us/library/aa969285.aspx),
which was the original inspiration for this idea. Of course, this
negates "write once, run anywhere" but I could accept that if I could
implement it for even a few other systems.
The real question is whether any non-Windows systems provide anything
similar. I had thought of using the file inodes, rather than the
paths, to get such behavior on Linux (and maybe other such systems),
but I don't think that's the right direction. As I understand it,
inodes are guaranteed unique only within a particular filesystem; so
if the file moves to a different partition, its inode would change.
My question for the Java-programming audience is whether there are
other ways to achieve this feature, preferably pure-Java ones.
Thanks for your replies,
-Jason Chang
I am writing an application that will track data about files. Once the
application becomes aware of a particular file, I would like to add a
feature whereby, even if the nominal pathname has changed, it is still
able to locate the file. I have thought of a few ways one might do
this:
1) Have the program run a thread that constantly watches each known
file. Not only is this inefficient, it also feels dirty; but it would
get the job done in a cross-platform way.
2) Make use of operating sytem APIs that implement this kind of
behavior. For example, the Windows Shell API provides for "copy hook
handlers" (http://msdn2.microsoft.com/en-us/library/aa969285.aspx),
which was the original inspiration for this idea. Of course, this
negates "write once, run anywhere" but I could accept that if I could
implement it for even a few other systems.
The real question is whether any non-Windows systems provide anything
similar. I had thought of using the file inodes, rather than the
paths, to get such behavior on Linux (and maybe other such systems),
but I don't think that's the right direction. As I understand it,
inodes are guaranteed unique only within a particular filesystem; so
if the file moves to a different partition, its inode would change.
My question for the Java-programming audience is whether there are
other ways to achieve this feature, preferably pure-Java ones.
Thanks for your replies,
-Jason Chang