package miaou-core

  1. Overview
  2. Docs
Miaou core/widgets (no drivers, no SDL)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.5.2.tar.gz
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6

doc/src/miaou-core.interfaces/system.ml.html

Source file system.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2025 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(*****************************************************************************)
(* System capability implementation living in miaou_interfaces.
   This lets other libraries depend on the small interfaces package. *)

module Capability = Capability

type file_read = string -> (string, string) result

type file_write = string -> string -> (unit, string) result

type run_result = {exit_code : int; stdout : string; stderr : string}

type t = {
  file_exists : string -> bool;
  is_directory : string -> bool;
  read_file : file_read;
  write_file : file_write;
  mkdir : string -> (unit, string) result;
  run_command :
    argv:string list -> cwd:string option -> (run_result, string) result;
  get_current_user_info : unit -> (string * string, string) result;
  get_disk_usage : path:string -> (int64, string) result;
  list_dir : string -> (string list, string) result;
  probe_writable : path:string -> (bool, string) result;
  get_env_var : string -> string option;
}

let key : t Capability.key = Capability.create ~name:"System"

let set v = Capability.set key v

let get () = Capability.get key

let require () = Capability.require key