module OpamFilename: sig
.. end
Typed filename manipulation
module Base: OpamMisc.ABSTRACT
Basenames
module Dir: OpamMisc.ABSTRACT
Directory names
val cwd : unit -> Dir.t
Return the current working directory
val rmdir : Dir.t -> unit
Remove a directory
val mkdir : Dir.t -> unit
Create a directory
val rec_dirs : Dir.t -> Dir.t list
List the sub-directory recursively
val sub_dirs : Dir.t -> Dir.t list
List the sub-directory
val in_dir : Dir.t -> (unit -> 'a) -> 'a
Evaluate a function in a given directory
val exec : Dir.t ->
?env:(string * string) list -> ?name:string -> string list list -> unit
Execute a list of commands in a given directory
val move_dir : src:Dir.t -> dst:Dir.t -> unit
Move a directory
val copy_dir : src:Dir.t -> dst:Dir.t -> unit
Copy a directory
val copy_unique_dir : src:Dir.t -> dst:Dir.t -> unit
Copy the unique directory in src
to dst
val link_dir : src:Dir.t -> dst:Dir.t -> unit
Link a directory
val exists_dir : Dir.t -> bool
Does the directory existsb ?
val dirname_dir : Dir.t -> Dir.t
Return the parent directory
val basename_dir : Dir.t -> Base.t
Return the deeper directory name
val raw_dir : string -> Dir.t
Creation from a raw string (as http://<path>)
val with_tmp_dir : (Dir.t -> 'a) -> 'a
Execute a function in a temp directory
include OpamMisc.ABSTRACT
val create : Dir.t -> Base.t -> t
Create a filename from a Dir.t and a basename
val of_basename : Base.t -> t
Create a file from a basename and the current working directory
as dirname
val raw_file : string -> t
Creation from a raw string (as http://<path>)
val prettify : t -> string
Prettify a filename:
- replace /path/to/opam/foo by <opam>/foo
- replace /path/to/home/foo by ~/foo
val prettify_dir : Dir.t -> string
Prettify a dirname.
val dirname : t -> Dir.t
Return the directory name
val basename : t -> Base.t
Return the base name
val read : t -> string
Retrieves the contents from the hard disk.
val remove : t -> unit
Removes everything in filename
if existed.
val write : t -> string -> unit
Removes everything in filename
if existed, then write contents
instead.
val exists : t -> bool
see Sys.file_exists
val check_suffix : t -> string -> bool
Check whether a file has a given suffix
val add_extension : t -> string -> t
Add a file extension
val chop_extension : t -> t
Remove the file extension
val rec_files : Dir.t -> t list
List all the filenames, recursively
val with_contents : (string -> 'a) -> t -> 'a
Apply a function on the contents of a file
val copy_in : t -> Dir.t -> unit
Copy a file in a directory
val move : src:t -> dst:t -> unit
Move a file
val link_in : t -> Dir.t -> unit
Symlink a file in a directory
val copy : src:t -> dst:t -> unit
Copy a file
val link : src:t -> dst:t -> unit
Symlink a file. If symlink is not possible on the system, use copy instead.
: t -> Dir.t -> unit
Extract an archive in a given directory (it rewrites the root to
match Dir.t
dir if needed)
: t -> Dir.t -> unit
Extract an archive in a given directory (which should already exists)
val starts_with : Dir.t -> t -> bool
Check wether a filename starts by a given Dir.t
val remove_prefix : Dir.t -> t -> string
Remove a prefix from a file name
val remove_suffix : Base.t -> t -> string
Remove a suffix from a filename
val download : overwrite:bool -> t -> Dir.t -> t
download a remote file in a given directory. Return the location
of the downloaded file if the download is successful.
val download_iter : overwrite:bool -> t list -> Dir.t -> t
iterate downloads until one is sucessful
val patch : t -> Dir.t -> unit
Apply a patch to a directory
val digest : t -> string
Compute the MD5 digest of a file
val touch : t -> unit
Create an empty file
val chmod : t -> int -> unit
Change file permissions
val address_of_string : string -> Dir.t
Create an local of remote address from a string,
depending whether the string exits in the filesystem.
val with_flock : t -> ('a -> 'b) -> 'a -> 'b
File locks
module OP: sig
.. end
module Attribute: sig
.. end
Simple structure to hanle file attributes