package oasis

  1. Overview
  2. Docs

Unix path manipulation

The filename and dirname used in '_oasis' file and OASISTypes.package are always encoded as Unix path. They are changed when using it on the target system.

  • author Sylvain Le Gall
type unix_filename = string
type unix_dirname = unix_filename
type host_filename = string
type host_dirname = host_filename
val current_dir_name : unix_filename

'.' on Unix.

val is_current_dir : unix_filename -> bool

Test if the filename is current dir (either '.' or '') on Unix.

val parent_dir_name : unix_filename

'..' on Unix.

concat fn1 fn2 Concatenate fn1 and fn2, i.e. fn1^'/'^fn2.

val make : unix_filename list -> unix_filename

make lst Concatenate all filename components of lst.

val dirname : unix_filename -> unix_filename

dirname fn Return directory name of fn or current_dir_name if no directory name is defined.

val basename : unix_filename -> unix_filename

basename fn Return filename without its directory name.

val chop_extension : unix_filename -> unix_filename

chop_extension fn Remove the last part of the filename, after a '.', return fn if there is no extension.

val check_extension : unix_filename -> string -> bool

check_extension fn ext Check that the filen fn has the extension ext. Not exported

val add_extension : unix_filename -> string -> unix_filename

add_extension fn ext Add the extension ext to the filename fn. Not exported

val replace_extension : unix_filename -> string -> unix_filename

replace_extension fn ext Add the extension ext to the filename fn. Not exported

val capitalize_file : unix_filename -> unix_filename

capitalize_file fn Return filename capitalized.

val uncapitalize_file : unix_filename -> unix_filename

uncapitalize_file fn Return filename uncapitalized.

Try to compress the filename by removing '.' and collapsing '..'. Not exported

val make_relative : unix_filename -> unix_filename -> unix_filename

make_relative fn_root fn Make fn relative to fn_root. Not exported

val is_current : unix_filename -> bool

Test if the filename is the current directory. Not exported

Set for Unix path. Not exported