From a4d78d6712101baaea1f89890635e6ef5e4b8bac Mon Sep 17 00:00:00 2001 From: Dustin Brett Date: Sun, 29 May 2022 13:07:25 -0700 Subject: [PATCH] Maybe only check exists once --- components/system/Dialogs/Run/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/system/Dialogs/Run/index.tsx b/components/system/Dialogs/Run/index.tsx index a33afc96b2..a6c39d8ba1 100644 --- a/components/system/Dialogs/Run/index.tsx +++ b/components/system/Dialogs/Run/index.tsx @@ -51,13 +51,14 @@ const Run: FC = () => { ); const [resourcePid, ...resourceUrl] = resource.split(" "); let resourcePath = resource; + const resourceExists = await exists(resourcePath); - if (!(await exists(resourcePath))) { + if (!resourceExists) { resourcePath = resourceUrl.length > 0 ? resourceUrl.join("") : resourcePid; } - if (await exists(resourcePath)) { + if (resourceExists || (await exists(resourcePath))) { const stats = await stat(resourcePath); if (stats.isDirectory()) {