From c680c0b6af2c7dad16958f4d96b12d727d4ad707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Mon, 23 Jan 2023 15:17:47 +0100 Subject: [PATCH] Error if cache folder is outside project --- src/generate.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/generate.ts b/src/generate.ts index bf5b088..0f4558d 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -64,13 +64,10 @@ export default async ( const cacheFolderAbs = configuration.get(`cacheFolder`); let cacheFolderExpr: string; if (cacheFolderAbs.startsWith(cwd)) { - cacheFolderExpr = - "./" + ppath.relative(ppath.dirname(nixExprPath), cacheFolderAbs); + cacheFolderExpr = json(ppath.relative(cwd, cacheFolderAbs)); } else { - cacheFolderExpr = json(cacheFolderAbs); - report.reportWarning( - 0, - `The cache folder ${cacheFolderAbs} is outside the project - it may not be reachable by the Nix build` + throw Error( + `The cache folder ${cacheFolderAbs} is outside the project, this is currently not supported` ); }