From 57605e87b8b2d5473eaa288e0f23e6bcc16c859c Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 21 Jan 2025 22:19:56 +0530 Subject: [PATCH] refactor(lib): use declared tool dir and use `assert` to handle nil --- toolchainlib/src/init.luau | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchainlib/src/init.luau b/toolchainlib/src/init.luau index 5732333..ffa0030 100644 --- a/toolchainlib/src/init.luau +++ b/toolchainlib/src/init.luau @@ -173,13 +173,13 @@ function installTool(tool: ToolId, installPath: pathfs.Path): number barFns.start(bar) -- init -- If the tool installation directory was not present, we create it - local toolDir = Option.from(installPath:parent()):unwrap() + local toolDir = assert(installPath:parent(), "Install path did not have parent dir") if not pathfs.isDir(toolDir) then pathfs.writeDir(toolDir) end -- Attempt to read an existing lock in EAFP fashion - local installLockFile = assert(installPath:parent(), "Install path did not have parent dir"):join("LOCK") + local installLockFile = toolDir:join("LOCK") local isLocked, existingInstallPath = pcall(pathfs.readFile, installLockFile) if isLocked then -- If the lock was held and we know the same tool that we are trying to install