Lucene.Net.Store.FSDirectory.DeleteFile C# (CSharp) Method

DeleteFile() public method

Removes an existing file in the directory.
public DeleteFile ( string name ) : void
name string
return void
        public override void DeleteFile(string name)
        {
            EnsureOpen();
            FileInfo file = new FileInfo(Path.Combine(directory.FullName, name));
            try
            {
                file.Delete();
                if (File.Exists(file.FullName))
                {
                    throw new System.IO.IOException("Cannot delete " + file);
                }
            }
            catch (Exception)
            {
                throw new System.IO.IOException("Cannot delete " + file);
            }
            StaleFiles.Remove(name);
        }

Usage Example

示例#1
0
 public override void  DeleteFile(System.String name, IState state)
 {
     fsDir.DeleteFile(name, null);
 }