Im using litedb as a file index, whereby I recreate the directory structure of a file share and drop a litedb.db file into each directory in my hierarchy. The problem I'm encountering seems to be where the directory structure is more than 260 characters long (see error message below). Is there a way to enable support for long file names in the connections string when connecting to litedb? Alternatively is there a way to instantiate my instance of litedb using some other approach (such as a file.open AlphaFS).
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\......\Some deep directory which is 260+ characters long\index.db'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at LiteDB.FileDiskService.Initialize(Logger log, String password)
at LiteDB.LiteEngine..ctor(IDiskService disk, String password, Nullable`1 timeout, Int32 cacheSize, Logger log, Boolean utcDate)
at LiteDB.LiteDatabase.<>c__DisplayClass11_0.<.ctor>b__0()
at LiteDB.LazyLoad`1.get_Value()
at LiteDB.LiteCollection`1.EnsureIndex(String field, String expression, Boolean unique)
at LiteDB.LiteCollection`1.EnsureIndex[K](Expression`1 property, Boolean unique)
LiteDB uses FileStream
ctor to open data file, so it's could be a problem with long paths. But, you can use Stream
as initializer to you database, so you can open in any platform.