refactor: Simplified absolute path resolution code.

This commit is contained in:
2026-06-24 14:05:35 -04:00
parent de1594d9d1
commit 3331a40053
5 changed files with 25 additions and 42 deletions

View File

@@ -305,7 +305,11 @@ db_insert :: proc(db: ^Db, file: EnvFile) -> bool {
}
// Result will be freed when `db_close` is called.
//
// Expects an absolute path
db_fetch :: proc(db: ^Db, path: string) -> (EnvFile, bool) {
assert(os.is_absolute_path(path))
sql: cstring = "SELECT path, remotes, sha256, contents FROM envr_env_files WHERE path = ?"
stmt: sqlite.Stmt
rc := sqlite.prepare_v2(db.conn, sql, -1, &stmt, nil)