コード例 #1
0
        // We always have to query the Sqlite store first, because of our
        // EA nightmare scenario: a file whose permissions or ownership get
        // changed after the EAs have been attached.  Thus attributes in
        // the database always trump those found in EAs.

        public FileAttributes Read(string path)
        {
            FileAttributes attr;

            attr = store_sqlite.Read(path);

            if (attr != null)
            {
                // If we have write access to the path but it has attributes
                // stored in the sqlite file attributes db, we should attach them
                // to the file with EAs and delete the record from the db.

                if (!FileSystem.IsWritable(path))
                {
                    return(attr);
                }

                bool success = store_ea.Write(attr);
                if (success)
                {
                    store_sqlite.Drop(path);
                }
            }
            else
            {
                attr = store_ea.Read(path);
            }
            return(attr);
        }