File path limit

Jan 18, 2012 at 3:16 PM

Hi.

There seems to be a limit of 50 characters for the file path when storing files.  Not sure if this is a bug or by design.

Jan 18, 2012 at 3:23 PM

Hi David,

 

Yep, it was design for that. My index page has a fixed length for each item. Because that, I fixed in 41 chars. Please, take a look on IndexNode.cs class, on FILENAME_SIZE. If you need more, you can change this const (but be carefull because it's must be changed INDEX_NODE_SIZE too).

Jan 18, 2012 at 4:19 PM

:)  Figured something else needed changing.  I changed the FILENAME_SIZE, and started getting a different error.  I'll play with the INDEX_NODE_SIZE and let you know how it goes.

Jan 18, 2012 at 4:23 PM

Obvserve that storage file must be new. Exiting files (.fdb) will not work (IndexNode will loose pointers :)

Jan 18, 2012 at 4:28 PM

And NODES_PER_PAGE (in IndexPage) must be less than 50. Today we have 50 items per page x 81 bytes per index = 4050 bytes per page (Page has a fixed length = 4096). Eg. if you change FILENAME_SIZE from 41 to 80, you must change INDEX_NODE_SIZE = 120 and NODES_PER_PAGE = 34 (total 4080 bytes per page = less than 4096)

Jan 18, 2012 at 8:33 PM

Ok.. so I made the following changes:

  • FILENAME_SIZE:  changed 41 -> 256.  I know this seems excessive and makes the database file size larger, but it will handle any file path on a Windows filesystem (Windows still has a silly limit of 256 chars for an entire path, which is a royal pain whenever the limit is reached).
  • INDEX_NODE_SIZE:  changed 81 -> 296 (81 + the new added file name length size)
  • NODES_PER_PAGE:  changed 50 -> 13.  Yikes!  This is the big drawback of supporting large file paths, I guess.

I tested it by storing all XML files on my hard drive in the File DB.  Nice!  The speed is impressive.