Author: toad
Date: 2008-06-19 23:01:23 +0000 (Thu, 19 Jun 2008)
New Revision: 20504
Modified:
branches/db4o/freenet/src/freenet/support/io/FilenameGenerator.java
Log:
Check whether they are the same directory.
Modified: branches/db4o/freenet/src/freenet/support/io/FilenameGenerator.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/io/FilenameGenerator.java
2008-06-19 22:57:31 UTC (rev 20503)
+++ branches/db4o/freenet/src/freenet/support/io/FilenameGenerator.java
2008-06-19 23:01:23 UTC (rev 20504)
@@ -116,10 +116,12 @@
*/
public void init(File dir, String prefix, Random random) throws
IOException {
this.random = random;
- if(tmpDir.equals(dir) && this.prefix.equals(prefix)) {
+ File oldDir = FileUtil.getCanonicalFile(tmpDir);
+ File newDir = FileUtil.getCanonicalFile(dir);
+ if(oldDir.equals(dir) && this.prefix.equals(prefix)) {
Logger.normal(this, "Initialised FilenameGenerator
successfully - no change in dir and prefix: dir="+dir+" prefix="+prefix);
- } else if(!tmpDir.equals(dir) && this.prefix.equals(prefix)) {
- if((!dir.exists()) && tmpDir.renameTo(dir)) {
+ } else if(!oldDir.equals(newDir) && this.prefix.equals(prefix))
{
+ if((!dir.exists()) && oldDir.renameTo(dir)) {
tmpDir = dir;
// This will interest the user, since they
changed it.
String msg = "Successfully renamed persistent
temporary directory from "+tmpDir+" to "+dir;