Fixing another bug with deletion detection. Now it seems to work
diff --git a/gui/fs-watcher.cc b/gui/fs-watcher.cc
index 18b6f77..cddda7e 100644
--- a/gui/fs-watcher.cc
+++ b/gui/fs-watcher.cc
@@ -177,7 +177,7 @@
filesystem::path triggeredDir (dirPath.toStdString ());
- FileItemsPtr files = m_fileState->LookupFilesInFolderRecursively (triggeredDir.generic_string ());
+ FileItemsPtr files = m_fileState->LookupFilesInFolderRecursively (triggeredDir.relative_path ().generic_string ());
for (std::list<FileItem>::iterator file = files->begin (); file != files->end (); file ++)
{
filesystem::path testFile = filesystem::path (m_dirPath.toStdString ()) / file->filename ();
diff --git a/src/action-log.cc b/src/action-log.cc
index a6b26e4..edd4ed8 100644
--- a/src/action-log.cc
+++ b/src/action-log.cc
@@ -784,17 +784,19 @@
FileItemsPtr
ActionLog::LookupFilesInFolderRecursively (const std::string &folder)
{
- // sqlite3_trace(m_db, xTrace, NULL);
+ _LOG_DEBUG ("LookupFilesInFolderRecursively: [" << folder << "]");
sqlite3_stmt *stmt;
-
if (folder != "")
{
sqlite3_prepare_v2 (m_db,
"SELECT filename,device_name,seq_no,file_hash,strftime('%s', file_mtime),file_chmod,file_seg_num "
" FROM FileState "
" WHERE type = 0 AND (directory = ? OR directory LIKE ?)", -1, &stmt, 0);
+ _LOG_DEBUG_COND (sqlite3_errcode (m_db) != SQLITE_OK, sqlite3_errmsg (m_db));
+
sqlite3_bind_text (stmt, 1, folder.c_str (), folder.size (), SQLITE_STATIC);
+ _LOG_DEBUG_COND (sqlite3_errcode (m_db) != SQLITE_OK, sqlite3_errmsg (m_db));
ostringstream escapedFolder;
for (string::const_iterator ch = folder.begin (); ch != folder.end (); ch ++)
@@ -806,7 +808,9 @@
}
escapedFolder << "/" << "%";
string escapedFolderStr = escapedFolder.str ();
+
sqlite3_bind_text (stmt, 2, escapedFolderStr.c_str (), escapedFolderStr.size (), SQLITE_STATIC);
+ _LOG_DEBUG_COND (sqlite3_errcode (m_db) != SQLITE_OK, sqlite3_errmsg (m_db));
}
else
{