Here's the second (and hopefully final!) version of my symlink patch.
I only changed one line from the original version:
String filePath = dirPath + "/" + file.getPath().substring(2);
The "substring(2)" on the end is apparently necessary to get rid of the
"./" in the filename, so that the metadata file will contain "/dir/file"
instead of "/dir/./file".
--
Greg Wooledge | "Truth belongs to everybody."
[EMAIL PROTECTED] | - The Red Hot Chili Peppers
http://wooledge.org/~greg/ |
--- src/relentless/gj/cli/ManifestFile.java.orig Sun May 20 16:09:30 2001
+++ src/relentless/gj/cli/ManifestFile.java Wed May 23 21:16:38 2001
@@ -270,7 +270,7 @@
}
java.io.File file = new java.io.File(dir, records[i].getFileName());
- String filePath = file.getCanonicalPath();
+ String filePath = file.getPath();
int p = filePath.indexOf(dirPath);
// 3) Resolved file name must be in root directory hierarchy.
@@ -718,7 +718,7 @@
// Create manifest file entry.
// REDFLAG: test. suspect....
String relativePath
- =
currentSegment.getCanonicalPath().substring(rootDirAsDir.getCanonicalPath().length()
+ =
+currentSegment.getPath().substring(rootDirAsDir.getPath().length()
+ 1);
records[i] = new ManifestFileRecord("freenet:CHK@", relativePath,
mimeType);
}
@@ -927,8 +927,8 @@
*/
public final static String getRelativeName(java.io.File dir, java.io.File file)
throws java.io.IOException {
- String dirPath = dir.getCanonicalPath();
- String filePath = file.getCanonicalPath();
+ String dirPath = dir.getPath();
+ String filePath = dirPath + "/" + file.getPath().substring(2);
int p = filePath.indexOf(dirPath);
if ((p != 0) || (dirPath.length() >= filePath.length())) {
System.err.println("dirPath: " + dirPath);
PGP signature