Frama-C:
Plug-ins:
Libraries:

Frama-C API - User_dir_opt

Basically User_dir but with an option to override the original path.

  • since 30.0-Zinc
include User_dir
val get_dir : ?create_path:bool -> string -> Filepath.Normalized.t

get_dir ~create_path name tries to get the directory name. The function aborts if:

  • a file named name exists,
  • creating a the directory fails.

Otherwise returns the path, and creates it if create_path is true (it defaults to false). Subdirectories modules can be created with Builder.Make_user_dir and Builder.Make_user_dir_opt.

val get_file : ?create_path:bool -> string -> Filepath.Normalized.t

get_file ~create_path name tries to get the file name. The function aborts if:

  • a directory named name exists,
  • creating the path to the file fails.

Otherwise returns the path, and creates the directories that lead to the file if create_path is true (it defaults to false). The file is *not* created by the function.

val set : Filepath.Normalized.t -> unit

Sets the <user-dir> directory (without creating it).

val get : unit -> Filepath.Normalized.t
  • returns

    the <user-dir> directory (without creating it).

val is_set : unit -> bool
  • returns

    whether the <user-dir> has been set.