package file_path

  1. Overview
  2. Docs
A library for typed manipulation of UNIX-style file paths

Install

Dune Dependency

Authors

Maintainers

Sources

file_path-v0.15.0.tar.gz
sha256=4c44185450fffa919bf900db1b54f2788f6831048997df390ef3bcf58395c41c

doc/file_path.file_path_unix_async/File_path_unix_async/index.html

Module File_path_unix_asyncSource

Sourcemodule type S = sig ... end
include S
include File_path_io.S with type 'a io := 'a Async.Deferred.t
Sourceval executable_name : File_path.t Core.Lazy.t

The currently running executable.

OCaml semantics do not guarantee an absolute path here.

File I/O Wrappers

These functions abstract over either In_channel and Out_channel, or Async.Reader and Async.Writer.

Sourceval read_file : File_path.t -> string Async.Deferred.t
Sourceval write_file : File_path.t -> contents:string -> unit Async.Deferred.t
Sourceval load_as_sexp : File_path.t -> of_sexp:(Core.Sexp.t -> 'a) -> 'a Async.Deferred.t
Sourceval load_as_sexps : File_path.t -> of_sexp:(Core.Sexp.t -> 'a) -> 'a list Async.Deferred.t
Sourceval save_sexps : File_path.t -> Core.Sexp.t list -> unit Async.Deferred.t
Sourceval save_as_sexp : File_path.t -> 'a -> sexp_of:('a -> Core.Sexp.t) -> unit Async.Deferred.t
Sourceval save_as_sexps : File_path.t -> 'a list -> sexp_of:('a -> Core.Sexp.t) -> unit Async.Deferred.t

Filename Wrappers

These functions abstract over Filename_unix.

Sourceval realpath_relative_to_cwd : File_path.t -> File_path.Absolute.t Async.Deferred.t

Sys Wrappers

These functions abstract over either Core.Sys or Async.Sys.

Sourceval exists : File_path.t -> [ `Yes | `No | `Unknown ] Async.Deferred.t
Sourceval exists_exn : File_path.t -> bool Async.Deferred.t
Sourceval is_directory : File_path.t -> [ `Yes | `No | `Unknown ] Async.Deferred.t
Sourceval is_directory_exn : File_path.t -> bool Async.Deferred.t
Sourceval is_file : File_path.t -> [ `Yes | `No | `Unknown ] Async.Deferred.t
Sourceval is_file_exn : File_path.t -> bool Async.Deferred.t

Unix Wrappers

These functions abstract over either Core_unix or Async.Unix.

Sourceval rename : src:File_path.t -> dst:File_path.t -> unit Async.Deferred.t
Sourceval mkdir : ?parents:bool -> File_path.t -> unit Async.Deferred.t

Current Directory Functions

These functions combine File_path and getcwd.

Like File_path.make_absolute ~under:(getcwd ()). Avoids calling getcwd unless necessary.

Sourceval make_relative_to_cwd : File_path.t -> File_path.Relative.t option Async.Deferred.t

Like File_path.make_relative ~if_under:(getcwd ()). Avoids calling getcwd unless necessary.

Sourceval make_relative_to_cwd_exn : File_path.t -> File_path.Relative.t Async.Deferred.t

Like make_relative_to_cwd. Raises instead of returning None.

Sourceval make_relative_to_cwd_if_possible : File_path.t -> File_path.t Async.Deferred.t

Like make_relative_to_cwd. Returns the original path instead of None.

OCaml

Innovation. Community. Security.