procfs (/proc/) does not exists on some system (macosx).
Therefore the heuristic used to find nit_dir will fail on those system
when the command is invoked from the PATH.
The solution is to add another heuristic, where the program_name is
manually searched inside the directories of PATH in order to find the
original directory.
Reported-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>
if res.file_exists and "{res}/src/nit.nit".file_exists then return res.simplify_path
end
+ # search in the PATH
+ var ps = "PATH".environ.split(":")
+ for p in ps do
+ res = p/".."
+ if res.file_exists and "{res}/src/nit.nit".file_exists then return res.simplify_path
+ end
+
return null
end
end