Skip to content

Commit

Permalink
tlcommon: search_module should take search_dtl argument into account …
Browse files Browse the repository at this point in the history
…when caching
  • Loading branch information
euclidianAce committed Jul 23, 2024
1 parent c785647 commit d48be38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions build/cyan/tlcommon.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/cyan/tlcommon.tl
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,13 @@ local found_modules: {string:fs.Path} = {}
---@desc
--- A wrapper around `tl.search_module` but, returns an `fs.Path` and will cache results
function common.search_module(name: string, search_dtl: boolean): fs.Path
if not found_modules[name] then
local key <const> = name .. ":" .. (search_dtl and "t" or "f")
if not found_modules[key] then
local found, fd = tl.search_module(name, search_dtl)
if found then fd:close() end
found_modules[name] = fs.path.new(found)
found_modules[key] = fs.path.new(found)
end
return found_modules[name]
return found_modules[key]
end

---@desc
Expand Down

0 comments on commit d48be38

Please sign in to comment.