From 53cf9b887052b8acf5b6e98abc1ac8e1e0b3478d Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Wed, 11 Nov 2020 21:15:09 +0100 Subject: [PATCH] [package] Workaround realpath failing with non-existing files Fixes #432 , introduced in #289 This whole code needs more investigation as the logic seems quite strange, in particular I think the core of LP should not mess with filesystem low-level details, but hoping for a quick fix. --- src/core/package.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/package.ml b/src/core/package.ml index 44f35d673..873e4063f 100644 --- a/src/core/package.ml +++ b/src/core/package.ml @@ -75,7 +75,12 @@ let read : file_path -> config_data = fun fname -> [Sys_error] is raised. Note that [fname] is first normalized with a call to [Filename.realpath]. *) let find_config : file_path -> file_path option = fun fname -> - let fname = Filename.realpath fname in + (* workaround #432 , this whole code should be reworked tho *) + let fname = + if Sys.file_exists fname + then Filename.realpath fname + else fname + in let fname = if Sys.is_directory fname then fname else Filename.dirname fname in