Use logical paths rather than physical

This commit is contained in:
D. Berge
2023-08-30 14:54:27 +02:00
parent c99a625b60
commit ccf4bbf547

View File

@@ -95,7 +95,7 @@ class Datastore:
cursor.execute(qry, (filepath,)) cursor.execute(qry, (filepath,))
results = cursor.fetchall() results = cursor.fetchall()
if len(results): if len(results):
return (filepath, file_hash(filepath)) in results return (filepath, file_hash(configuration.translate_path(filepath))) in results
def add_file(self, path, cursor = None): def add_file(self, path, cursor = None):
@@ -107,7 +107,8 @@ class Datastore:
else: else:
cur = cursor cur = cursor
hash = file_hash(path) realpath = configuration.translate_path(path)
hash = file_hash(realpath)
qry = "CALL add_file(%s, %s);" qry = "CALL add_file(%s, %s);"
cur.execute(qry, (path, hash)) cur.execute(qry, (path, hash))
if cursor is None: if cursor is None:
@@ -176,7 +177,7 @@ class Datastore:
else: else:
cur = cursor cur = cursor
hash = file_hash(path) hash = file_hash(configuration.translate_path(path))
qry = """ qry = """
UPDATE raw_lines rl UPDATE raw_lines rl
SET ntbp = %s SET ntbp = %s