lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corey Trager <>
Subject ject: 2 changes to FSDirectory.cs that allowed Lucene.Net to work on a shared host, at GoDaddy.
Date Sun, 12 Oct 2008 13:37:10 GMT
I am now using Lucene.NET at the demo of my open source bug tracking app, BugTracker.NET, at   I don't have a good understanding of <trust level=... in
but I guess there are settings there that caused the call to GetTempPath() below to fail.
LOCK_DIR isn't used anyway, I just commented out the call.   

After I got past that, the next obstacle was constructing System.IO.FileInfo.  I used a different
way to do the same thing, System.IO.DirectoryInfo.  I have no idea why one way violates a
policy but the other way doesn't, but it worked.  The only reason why I even tried it was
I happened to have other code up and running at GoDaddy that uses System.IO.DirectoryInfo.

// Corey Trager, Oct 2008: Commented call to GetTempPath to workaround permission restrictions
shared host.
// LOCK_DIR isn't used anyway.
        public static readonly System.String LOCK_DIR = null; //
SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());

		public override System.String[] List()

/* Changes by Corey Trager, Oct 2008, to workaround permission restrictions at shared host
			    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(directory.FullName);
		        System.IO.FileInfo[] files = dir.GetFiles();
                string[] list = new string[files.Length];
                for (int i = 0; i < files.Length; i++)
                    list[i] = files[i].Name;
                return list;
/* end of changes */

//            System.String[] files =
SupportClass.FileSupport.GetLuceneIndexFiles(directory.FullName, IndexFileNameFilter.GetFilter());
//            for (int i = 0; i < files.Length; i++)
//            {
//                System.IO.FileInfo fi = new System.IO.FileInfo(files[i]);
//                files[i] = fi.Name;
//            }
//			  return files;


View raw message