Esempio n. 1
0
        static Indexable DirectoryToIndexable(DirectoryInfo dir, Queue modified_directories)
        {
            if (!dir.Exists)
            {
                return(null);
            }

            // Check if the directory information is stored in attributes store
            // And if the mtime of the directory is same as that in the attributes store
            FileAttributes attr = fa_store.Read(PathInIndex(dir.FullName));

            // If the directory exists in the fa store, then it is already indexed.
            if (attr != null)
            {
                // If we don't care about deleted content then we are fine.
                // If the attributes are up-to-date, then we are fine too.
                if (!arg_delete || FileAttributesStore.IsUpToDate(attr, FileSystem.GetLastWriteTimeUtc(dir.FullName)))
                {
                    return(null);
                }

                // But the last write time needs to be uptodate to support enable-deletion,
                // so we actually index the directories, even if --disable-directories
                // is set.
                modified_directories.Enqueue(dir);
            }

            // Create the indexable and add the standard properties we
            // use in the FileSystemQueryable.
            Uri       uri       = PathToUri(dir.FullName);
            Indexable indexable = new Indexable(uri);

            indexable.MimeType  = "inode/directory";
            indexable.NoContent = true;
            indexable.Timestamp = dir.LastWriteTimeUtc;

            // Store the directory information in the index anyway, but if --disable-directories
            // was passed, then do not store the names and other standard properties
            // used during searching
            if (!arg_disable_directories)
            {
                FSQ.AddStandardPropertiesToIndexable(indexable, dir.Name, Guid.Empty, false);
            }

            // Add directory name property
            string dirname = dir.Parent.FullName;

            indexable.AddProperty(Property.NewUnsearched(Property.ParentDirUriPropKey, PathToUri(dirname)));

            indexable.AddProperty(Property.NewBool(Property.IsDirectoryPropKey, true));

            return(indexable);
        }
Esempio n. 2
0
		public bool IsUpToDate (string path)
		{
			return FileAttributesStore.IsUpToDate (path);
		}
Esempio n. 3
0
		///////////////////////////////////////////////////////////////////////////

		// Convenience functions

		public bool IsUpToDate (string path, Filter filter)
		{
			return FileAttributesStore.IsUpToDate (path, filter);
		}