Hi,

I 'm working on 2 projects using VFS (FSUI a GUI ala MidnightCommander
and Ruper http://krysalis.org/cgi-bin/krywiki.pl?Ruper).

The attached patch include :
- creation of the root of a ZipFileSystem as a Folder
- getParent return the parent of ParentLayer for root of
layeredFileSystem

Like this Root of LayeredFileSystem like Zip could be manage more like a
"regular" folder.

-- 
*---------------------------------------------------------*
| Contrary to popular belief, UNIX is user-friendly. It   |
| just happens to be selective on who it makes friendship |
| with.                                                   |
|                       - Richard Cook                    |
*---------------------------------------------------------*
Index: src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java,v
retrieving revision 1.7
diff -u -u -r1.7 AbstractFileObject.java
--- src/java/org/apache/commons/vfs/provider/AbstractFileObject.java	22 Aug 2002 02:42:45 -0000	1.7
+++ src/java/org/apache/commons/vfs/provider/AbstractFileObject.java	4 Oct 2002 16:08:27 -0000
@@ -167,7 +167,7 @@
     protected long doGetLastModifiedTime() throws FileSystemException
     {
         final String message = REZ.getString( "get-last-modified-not-supported.error" );
-        throw new FileSystemException( message );
+        throw new FileSystemException( message );
     }

     /**
@@ -179,7 +179,7 @@
         throws FileSystemException
     {
         final String message = REZ.getString( "set-last-modified-not-supported.error" );
-        throw new FileSystemException( message );
+        throw new FileSystemException( message );
     }

     /**
@@ -202,7 +202,7 @@
         throws FileSystemException
     {
         final String message = REZ.getString( "set-attribute-not-supported.error" );
-        throw new FileSystemException( message );
+        throw new FileSystemException( message );
     }

     /**
@@ -339,8 +339,15 @@
     {
         if ( this == fs.getRoot() )
         {
-            // Root file has no parent
-            return null;
+            if (fs.getParentLayer() != null)
+            {
+                return fs.getParentLayer().getParent();
+            }
+            else
+            {
+                // Root file has no parent
+                return null;
+            }
         }

         // Locate the parent of this file
Index: src/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java,v
retrieving revision 1.3
diff -u -u -r1.3 ZipFileObject.java
--- src/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java	22 Aug 2002 01:32:49 -0000	1.3
+++ src/java/org/apache/commons/vfs/provider/zip/ZipFileObject.java	4 Oct 2002 16:08:27 -0000
@@ -47,12 +47,12 @@

     protected void setZipEntry( ZipEntry entry )
     {
-        if ( entry == null || this.entry != null )
+        if ( this.entry != null )
         {
             return;
         }
-
-        if ( entry.isDirectory() )
+
+        if ((entry == null) || ( entry.isDirectory() ))
             type = FileType.FOLDER;
         else
             type = FileType.FILE;
Index: src/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java,v
retrieving revision 1.8
diff -u -u -r1.8 ZipFileSystem.java
--- src/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java	22 Aug 2002 02:42:46 -0000	1.8
+++ src/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java	4 Oct 2002 16:08:27 -0000
@@ -75,7 +75,7 @@
                 fileObj.setZipEntry( entry );
                 continue;
             }
-
+
             fileObj = createZipFileObject( name, entry, zipFile );
             putFile( fileObj );

@@ -90,7 +90,7 @@
                 parent = (ZipFileObject) getFile( parentName );
                 if ( parent == null )
                 {
-                    parent = createZipFileObject( parentName, null, null );
+                    parent = createZipFileObject( parentName, null, zipFile );
                     putFile( parent );
                 }

@@ -100,7 +100,7 @@
         }
     }

-    protected ZipFileObject createZipFileObject( FileName name,
+    protected ZipFileObject createZipFileObject( FileName name,
                                                  ZipEntry entry,
                                                  ZipFile file )
         throws FileSystemException

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to