1 Reply Latest reply on Feb 12, 2010 3:46 PM by Andrew Rubinger

    Access to directories

    German Escobar Newbie

      If you have an Archive with a single file (i.e. /somewhere/inside/test.properties), only one entry is created in the MemoryMapArchiveImpl. So, a call to Archive.contains(ArchivePaths.create("/somewhere/inside/")) will return false. And Archive.get(..) will return null. Is this the expected behaviour?


      In my opinion, Archive.contains(...) should return true and Archive.get(...) should return ... well, a Node .. just kiddin'. The only possible thing I see we can return here right now is a DirectoryAsset.

        • 1. Re: Access to directories
          Andrew Rubinger Master

          I think the semantics must be changed to those similar to:


          mkdir -p /path/to/dir


          contains("/path/to") == true

          get("/path/to") has to return *something*.


          Which means we may have to adjust the testsuites to match.  Here we have to step lightly and carefully to ensure we aren't just changing tests to make stuff pass - they must pass correctly.


          And I think then a request to get("/path/to") should return ... well ... DirectoryAsset is a hack and "null" is incorrect. Maybe it must be a Container type, like Node.  If Node.getContents is empty, it's a directory.  Note that here we just expose Node; not that the thing is internally a tree.


          Thinking a bit on it.  Or anyone else can chime in.  If we go full boat, we expose the tree and allow client traversal.  Beginning to wonder if this is necessary.