package ecaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file working_directory.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
open! Core
open! Import

type t =
  | Of_current_buffer
  | Root
  | This of string
[@@deriving sexp_of]

let to_filename = function
  | Of_current_buffer -> Current_buffer.(get_buffer_local_exn directory)
  | Root -> "/"
  | This s -> s
;;

let within t sync_or_async ~f =
  Current_buffer.set_value_temporarily
    sync_or_async
    (Buffer_local.var Current_buffer.directory)
    (Some (t |> to_filename))
    ~f
;;
OCaml

Innovation. Community. Security.