From 694afdf008814ec45f6e39c24ccff099ca3a5832 Mon Sep 17 00:00:00 2001 From: araujo921 <53831977+leedigital@users.noreply.github.com> Date: Wed, 3 Aug 2022 01:54:07 -0300 Subject: [PATCH] :bug: Fix examples and templates not showing when ctjs is run outside of your home directory (#357 by @leedigital) --- src/node_requires/resources/projects/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node_requires/resources/projects/index.ts b/src/node_requires/resources/projects/index.ts index e28ba747e..3323e1893 100644 --- a/src/node_requires/resources/projects/index.ts +++ b/src/node_requires/resources/projects/index.ts @@ -20,7 +20,8 @@ const getExamplesDir = function (): string { if (isMac) { return path.join(process.cwd(), 'examples'); } - return path.join((nw.App as any).startPath, 'examples'); + // return path.join((nw.App as any).startPath, 'examples'); + return path.join(path.dirname(process.execPath), "examples"); } }; @@ -35,7 +36,8 @@ const getTemplatesDir = function (): string { if (isMac) { return path.join(process.cwd(), 'templates'); } - return path.join((nw.App as any).startPath, 'templates'); + // return path.join((nw.App as any).startPath, "templates"); + return path.join(path.dirname(process.execPath), "templates"); } };