Results 1 to 8 of 8

Thread: An Open Discussion on "Cannot scan directory to initialize CL_VirtualDirectoryList"

  1. #1

    Lightbulb An Open Discussion on "Cannot scan directory to initialize CL_VirtualDirectoryList"

    Dear All,


    I noticed that when you try to 'get_directory_listing()' an empty 'CL_VirtualDirectory' inside a zip archive file (i.e. 'is_zip_file == true' in the CL_VirtualFileSystem), a 'CL_Exception' will be thrown with the message: "Cannot scan directory to initialize CL_VirtualDirectoryList".

    I think there are two issues around this design:

    1) Request to list an empty directory is probably not a sin. Its just a common thing that people do every day.

    If you double click on an empty folder on Windows OS, you are very unlikely to be punished by a blue screen and so as on Linux, if you 'ls -l' an empty directory, you (probably) won't seen a segment fault as a consequence of your commend.

    Then, why we are so anxious about the 'get_directory_listing()' on an empty 'CL_VirtualDirectory' here? Should we just return an empty 'CL_VirtualDirectoryListing', which users can use the member function 'is_null()' to tell, back to the user instead of throwing an general 'CL_Exception'?

    2) Apart from my first argument, I also realised that this behaviour is inconsistent between zip archive (is_zip_file = true) and standard directory on the file system (is_zip_file = false). In the latter case, such exception ('Cannot scan directory to initialize CL_VirtualDirectoryList') will not be thrown, even the target directory is empty. At least, it is so on the Windows OS. Should this behaviour be consistent for both zipped archive and standard directory on OS?


    It would be nice that someone could give me some thoughts on this point. I am sincerely looking forward to hearing from you about this issue.


    Best regards,

    Chris

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    If the zip archive truly does have an empty directory, then it hsould of course be able to list the empty contents of it without throwing an exception. Anything else is a bug. However if the directory does not exist it should throw an exception.

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I don't mind it changing. If you send a patch, i'm sure it'll be accepted.

  4. #4

    Smile

    Quote Originally Posted by rombust View Post
    I don't mind it changing. If you send a patch, i'm sure it'll be accepted.

    Hi rombust,


    Thank you very much for your comment and your encouragement of making contribution to Clanlib.

    I am more than happy to contribute my time and do some changes around this issue.

    However, when I tried to commit the change, I met an authentication issue as login is required.

    Just wondering, do we have a general login for new guys doing casual commit?


    Best regards,

    Chris

  5. #5

    Smile

    Quote Originally Posted by Magnus Norddahl View Post
    If the zip archive truly does have an empty directory, then it hsould of course be able to list the empty contents of it without throwing an exception. Anything else is a bug. However if the directory does not exist it should throw an exception.

    Hi Magnus Norddahl,


    Thanks for your comments. I agree with you.


    Best regards,

    Chris

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    We don't allow anonymous commits (since they can be abused)

    Instead post the svn patch here on the forum.

    After a few patches, we then can create a svn user (subject to clanlib.org sysadmin approval)

  7. #7

    Post

    Quote Originally Posted by rombust View Post
    We don't allow anonymous commits (since they can be abused)

    Instead post the svn patch here on the forum.

    After a few patches, we then can create a svn user (subject to clanlib.org sysadmin approval)


    Hi rombust,


    Certainly.


    I recommend that the line 85 in the "virtual_file_source_zip.cpp" file being changed from "return !file_list.empty();" to "return true;"


    Best regards,

    Chris

  8. #8
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Patch applied to ClanLib 2.3 SVN and 2.4 SVN

Similar Threads

  1. Replies: 7
    Last Post: 04-02-2012, 07:40 PM
  2. Replies: 3
    Last Post: 03-21-2012, 05:40 AM
  3. Pilgrimís Quest: Problem in "Welcome to Fire woods!"
    By Floater in forum Dink Smallwood HD
    Replies: 0
    Last Post: 08-18-2009, 06:07 PM
  4. Multiple "keydown" signals on a single keystroke
    By zag in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 10-19-2008, 11:04 PM
  5. Di-Mart Guns -Explanation of the "Store Guy" event
    By rmcnew in forum Funeral Quest
    Replies: 2
    Last Post: 01-15-2004, 06:25 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •