working on adding files to repo and making sure no duplicates
This commit is contained in:
		@@ -33,19 +33,18 @@ func (db *DB) ConfigureDB(dbPath string) error {
 | 
			
		||||
// CheckIfFileCurrentlyMonitored checks if the file is already being monitored. This is a read-only check
 | 
			
		||||
// to see whether the file was correctly initialised
 | 
			
		||||
// (BUG) The hash causes the same file to be in database multiple times!
 | 
			
		||||
func (db *DB) CheckIfFileCurrentlyMonitored(src string, hash [16]byte) (File, error) {
 | 
			
		||||
func (db *DB) CheckIfFileCurrentlyMonitored(path string) bool {
 | 
			
		||||
	var file File
 | 
			
		||||
 | 
			
		||||
	//TODO: check this actually works still (don't need hash passed to this anymore)
 | 
			
		||||
	if err := db.One("Path", src, &file); err != nil {
 | 
			
		||||
	if err := db.One("Path", path, &file); err != nil {
 | 
			
		||||
		if err.Error() != "not found" {
 | 
			
		||||
			db.Err(err).Msg("Error finding file by path")
 | 
			
		||||
			return File{}, err
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
		db.Warn().Msg("no file found")
 | 
			
		||||
		return File{}, err
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	return file, nil
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RetrieveWatchedFiles all files that are in the database as "watched files"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user