XDG library path support for OCaml via Eio capabilities
linux macos ocaml xdg

Compare changes

Choose any two refs to compare.

+17 -1
.gitignore
···
-
_build
+
# OCaml build artifacts
+
_build/
+
*.install
+
*.merlin
+
+
# Third-party sources (fetch locally with opam source)
+
third_party/
+
+
# Editor and OS files
+
.DS_Store
+
*.swp
+
*~
+
.vscode/
+
.idea/
+
+
# Opam local switch
+
_opam/
+10
CHANGES.md
···
+
v1.1.0 (dev)
+
------------
+
+
- Remove dependency on `eio_main` for library (@avsm).
+
Thanks to @Alizter for the workaround in https://github.com/ocaml/dune/issues/12821).
+
+
v1.0.0 (2025-11-29)
+
-------------------
+
+
- Initial public release (@avsm)
+4
dune
···
+
(alias
+
(name default)
+
(deps
+
(alias_rec lib/all)))
+3 -3
dune-project
···
(authors "Anil Madhavapeddy")
(homepage "https://tangled.sh/@anil.recoil.org/xdge")
(maintainers "Anil Madhavapeddy <anil@recoil.org>")
-
(bug_reports "https://tangled.sh/@anil.recoil.org/xgde/issues")
+
(bug_reports "https://tangled.sh/@anil.recoil.org/xdge/issues")
(maintenance_intent "(latest)")
(package
···
(ocaml (>= 5.1.0))
(eio (>= 1.1))
(cmdliner (>= 1.2.0))
-
(fmt (>= 0.11.0))
+
fmt
xdg
-
(odoc :with-doc)
(eio_main :with-test)
+
(odoc :with-doc)
(alcotest (and :with-test (>= 1.7.0)))))
+5
lib/xdge.ml
···
+
(*---------------------------------------------------------------------------
+
Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
+
SPDX-License-Identifier: ISC
+
---------------------------------------------------------------------------*)
+
type source = Default | Env of string | Cmdline
type t = {
+5
lib/xdge.mli
···
+
(*---------------------------------------------------------------------------
+
Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
+
SPDX-License-Identifier: ISC
+
---------------------------------------------------------------------------*)
+
(** XDG Base Directory Specification support with Eio capabilities
This library provides an OCaml implementation of the XDG Base Directory
-2
test/dune
···
(executable
(name xdg_example)
-
(optional)
(libraries xdge eio_main cmdliner fmt))
(executable
(name test_paths)
-
(optional)
(libraries xdge eio eio_main))
(cram
+5
test/test_paths.ml
···
+
(*---------------------------------------------------------------------------
+
Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
+
SPDX-License-Identifier: ISC
+
---------------------------------------------------------------------------*)
+
let test_path_validation () =
Printf.printf "Testing XDG path validation...\n";
(* Test absolute path validation for environment variables *)
+4
test/test_paths.mli
···
+
(*---------------------------------------------------------------------------
+
Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
+
SPDX-License-Identifier: ISC
+
---------------------------------------------------------------------------*)
+5
test/xdg_example.ml
···
+
(*---------------------------------------------------------------------------
+
Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
+
SPDX-License-Identifier: ISC
+
---------------------------------------------------------------------------*)
+
let run (xdg, cfg) =
Fmt.pr "%a@.%a@.@.%a@.%a@."
Fmt.(styled `Bold string)
+4
test/xdg_example.mli
···
+
(*---------------------------------------------------------------------------
+
Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
+
SPDX-License-Identifier: ISC
+
---------------------------------------------------------------------------*)
+7 -15
xdge.opam
···
authors: ["Anil Madhavapeddy"]
license: "ISC"
homepage: "https://tangled.sh/@anil.recoil.org/xdge"
-
bug-reports: "https://tangled.sh/@anil.recoil.org/xgde/issues"
+
bug-reports: "https://tangled.sh/@anil.recoil.org/xdge/issues"
depends: [
"dune" {>= "3.20"}
"ocaml" {>= "5.1.0"}
···
"cmdliner" {>= "1.2.0"}
"fmt" {>= "0.11.0"}
"xdg"
-
"odoc" {with-doc}
"eio_main" {with-test}
+
"odoc" {with-doc}
"alcotest" {with-test & >= "1.7.0"}
]
+
x-maintenance-intent: ["(latest)"]
build: [
-
["dune" "subst"] {dev}
-
[
-
"dune"
-
"build"
-
"-p"
-
name
-
"-j"
-
jobs
-
"@install"
-
"@runtest" {with-test}
-
"@doc" {with-doc}
-
]
+
[ "dune" "subst" ] {dev}
+
[ "dune" "build" "-p" name "-j" jobs "@install" ]
+
[ "dune" "build" "-p" name "-j" jobs "runtest" ] {with-test & opam-version >= "2.2"}
+
[ "dune" "build" "-p" name "-j" jobs "@doc" ] {with-doc}
]
-
x-maintenance-intent: ["(latest)"]
+6
xdge.opam.template
···
+
build: [
+
[ "dune" "subst" ] {dev}
+
[ "dune" "build" "-p" name "-j" jobs "@install" ]
+
[ "dune" "build" "-p" name "-j" jobs "runtest" ] {with-test & opam-version >= "2.2"}
+
[ "dune" "build" "-p" name "-j" jobs "@doc" ] {with-doc}
+
]