You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Corey Trager <ct...@yahoo.com> on 2008/10/12 15:37:10 UTC
ject: 2 changes to FSDirectory.cs that allowed Lucene.Net to work on a shared host, at GoDaddy.
I am now using Lucene.NET at the demo of my open source bug tracking app, BugTracker.NET, at
http://ifdefined.com/btnet. I don't have a good understanding of <trust level=... in ASP.NET,
but I guess there are settings there that caused the call to GetTempPath() below to fail. Since
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 security
policy but the other way doesn't, but it worked. The only reason why I even tried it was because
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 at
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;
}