Error if cache folder is outside project

This commit is contained in:
Stéphan Kochen
2023-01-23 15:17:47 +01:00
parent c13edc73cd
commit c680c0b6af
+3 -6
View File
@@ -64,13 +64,10 @@ export default async (
const cacheFolderAbs = configuration.get(`cacheFolder`); const cacheFolderAbs = configuration.get(`cacheFolder`);
let cacheFolderExpr: string; let cacheFolderExpr: string;
if (cacheFolderAbs.startsWith(cwd)) { if (cacheFolderAbs.startsWith(cwd)) {
cacheFolderExpr = cacheFolderExpr = json(ppath.relative(cwd, cacheFolderAbs));
"./" + ppath.relative(ppath.dirname(nixExprPath), cacheFolderAbs);
} else { } else {
cacheFolderExpr = json(cacheFolderAbs); throw Error(
report.reportWarning( `The cache folder ${cacheFolderAbs} is outside the project, this is currently not supported`
0,
`The cache folder ${cacheFolderAbs} is outside the project - it may not be reachable by the Nix build`
); );
} }