Hi Peter,
Thanks for your response. I think the issue is with Java file equals method.From Java API documentation.
_______________________________________________________________
public boolean equals(Object obj)
Tests this abstract pathname for equality with the given object.
Returns true
if and only if the argument is not
null
and is an abstract pathname that denotes the same file
or directory as this abstract pathname. Whether or not two abstract
pathnames are equal depends upon the underlying system. On UNIX
systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows
systems it is not.
- ________________________________________________________________________________________
I compared using canonical paths and it worked in Windows system. (My changes in bold)
private final static boolean isInDirectoryImpl(final File directory, final File suspectedChild)
{
boolean result = false;
if (directory != null && suspectedChild != null)
{
try {
if (suspectedChild.getCanonicalPath().equals(directory.getCanonicalPath())) {
result = true;
}
else
{
result = isInDirectoryImpl(directory, suspectedChild.getParentFile());//true;
}
}
catch(IOException ie) {
}
}
return(result);
}
Thanks,
Deepak