+ # Shared files directory.
+ #
+ # Most often `nit/share/`.
+ var share_dir: String is lazy do
+ var sharedir = opt_share_dir.value
+ if sharedir == null then
+ sharedir = nit_dir / "share"
+ if not sharedir.file_exists then
+ fatal_error(null, "Fatal Error: cannot locate shared files directory in {sharedir}. Uses --share-dir to define it's location.")
+ end
+ end
+ return sharedir
+ end
+
+ # Guess a possible nit_dir.
+ #
+ # It uses, in order:
+ #
+ # * the option `opt_no_color`
+ # * the environment variable `NIT_DIR`
+ # * the runpath of the program from argv[0]
+ # * the runpath of the process from /proc
+ # * the search in PATH
+ #
+ # If there is errors (e.g. the indicated path is invalid) or if no
+ # path is found, then an error is displayed and the program exits.
+ #
+ # The result is returned without being assigned to `nit_dir`.
+ # This function is automatically called by `process_options`
+ fun locate_nit_dir: String