This is a proposed change I got really tired of writing unnecessary code all the time when opening FSDirectory
---------- Forwarded message ---------- From: <synhers...@apache.org> Date: Thu, Jun 14, 2012 at 1:19 PM Subject: svn commit: r1350178 - /incubator/ lucene.net/trunk/src/core/Store/FSDirectory.cs To: lucene-net-comm...@lucene.apache.org Author: synhershko Date: Thu Jun 14 10:19:13 2012 New Revision: 1350178 URL: http://svn.apache.org/viewvc?rev=1350178&view=rev Log: Allow for opening FSDirectory with a string A proposed change - I'm tired of creating a DirInfo object all the time, doesn't really add any value Modified: incubator/lucene.net/trunk/src/core/Store/FSDirectory.cs Modified: incubator/lucene.net/trunk/src/core/Store/FSDirectory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Store/FSDirectory.cs?rev=1350178&r1=1350177&r2=1350178&view=diff ============================================================================== --- incubator/lucene.net/trunk/src/core/Store/FSDirectory.cs (original) +++ incubator/lucene.net/trunk/src/core/Store/FSDirectory.cs Thu Jun 14 10:19:13 2012 @@ -210,6 +210,31 @@ namespace Lucene.Net.Store } } } + + /// <summary>Creates an FSDirectory instance, trying to pick the + /// best implementation given the current environment. + /// The directory returned uses the <see cref="NativeFSLockFactory" />. + /// + /// <p/>Currently this returns <see cref="SimpleFSDirectory" /> as + /// NIOFSDirectory is currently not supported. + /// + /// <p/><b>NOTE</b>: this method may suddenly change which + /// implementation is returned from release to release, in + /// the event that higher performance defaults become + /// possible; if the precise implementation is important to + /// your application, please instantiate it directly, + /// instead. On 64 bit systems, it may also good to + /// return <see cref="MMapDirectory" />, but this is disabled + /// because of officially missing unmap support in Java. + /// For optimal performance you should consider using + /// this implementation on 64 bit JVMs. + /// + /// <p/>See <a href="#subclasses">above</a> + /// </summary> + public static FSDirectory Open(string path) + { + return Open(new DirectoryInfo(path), null); + } /// <summary>Creates an FSDirectory instance, trying to pick the /// best implementation given the current environment.