@@ -197,13 +197,13 @@ let detectFull = projectDir => {
197197 };
198198};
199199
200- let getEsyCompiledBase = () => {
200+ let getEsyCompiledBase = (rootPath ) => {
201201 let env = Unix . environment() -> Array . to_list;
202202
203203 switch (Utils . getEnvVar(~env, "cur__original_root" ), Utils . getEnvVar(~env, "cur__target_dir" )) {
204204 | (Some (projectRoot ), Some (targetDir )) => Ok (Files . relpath(projectRoot, targetDir))
205205 | (_ , _ ) =>
206- switch (Commands . execResult("esy command-env --json" )) {
206+ switch (Commands . execResult("cd " ++ rootPath ++ " && esy command-env --json" )) {
207207 | Ok (commandEnv ) =>
208208 switch (Json . parse(commandEnv)) {
209209 | exception (Failure (message )) =>
@@ -239,7 +239,7 @@ let getCompiledBase = (root, buildSystem) => {
239239 | BsbNative (_ , Bytecode ) => Ok (root /+ "lib" /+ "bs" /+ "bytecode" )
240240 | Dune (Opam (_ )) => Ok (root /+ "_build" ) /* TODO maybe check DUNE_BUILD_DIR */
241241 | Dune (Esy (_ )) =>
242- let %try_wrap esyTargetDir = getEsyCompiledBase();
242+ let %try_wrap esyTargetDir = getEsyCompiledBase(root );
243243 root /+ esyTargetDir
244244 };
245245
@@ -384,7 +384,7 @@ let hiddenLocation = (rootPath, buildSystem) => {
384384 | BsbNative (_ , _ ) => Ok (rootPath /+ "node_modules" /+ ".lsp" )
385385 | Dune (Opam (_ )) => Ok (rootPath /+ "_build" /+ ".lsp" )
386386 | Dune (Esy (_ )) =>
387- let %try_wrap esyTargetDir = getEsyCompiledBase();
387+ let %try_wrap esyTargetDir = getEsyCompiledBase(rootPath );
388388 rootPath /+ esyTargetDir /+ ".lsp"
389389 };
390390};
0 commit comments