XDG library path support for OCaml via Eio capabilities
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): replace Printf/Format with Fmt across remaining packages

Migrate Printf.sprintf to Fmt.str, Format.fprintf to Fmt.pf, and
Format.pp_print_string to Fmt.string across bundle, gpt, hap, homebrew,
jsonwt, matter, mbr, meross, paseto, precommit, publicsuffix, qemu,
retry, sdnv, slack, sle, space-packet, spake2, sqlite, squashfs, tar,
tc, tcf, tcpcl, tm, tomlt, tty, uslp, vlog, wal, wire, yamlrw, yamlt,
osrelease, space, xdge, and crypto test runner.

+8 -9
+8 -9
lib/xdge.ml
··· 31 31 let current_perm = stat.perm land 0o777 in 32 32 if current_perm <> 0o700 then 33 33 failwith 34 - (Printf.sprintf 34 + (Fmt.str 35 35 "XDG_RUNTIME_DIR base directory %s has incorrect permissions: %o \ 36 36 (must be 0700)" 37 37 path_str current_perm); ··· 39 39 let uid = Unix.getuid () in 40 40 if stat.uid <> Int64.of_int uid then 41 41 failwith 42 - (Printf.sprintf 42 + (Fmt.str 43 43 "XDG_RUNTIME_DIR base directory %s not owned by current user (uid \ 44 44 %d, owner %Ld)" 45 45 path_str uid stat.uid) ··· 47 47 This would require filesystem type detection which is OS-specific. *) 48 48 with exn -> 49 49 failwith 50 - (Printf.sprintf "Cannot validate XDG_RUNTIME_DIR: %s" 51 - (Printexc.to_string exn)) 50 + (Fmt.str "Cannot validate XDG_RUNTIME_DIR: %s" (Printexc.to_string exn)) 52 51 53 52 let ensure_runtime_dir _fs app_runtime_path = 54 53 (* Base directory validation is done in resolve_runtime_dir, ··· 82 81 if Filename.is_relative path then 83 82 raise 84 83 (Invalid_xdg_path 85 - (Printf.sprintf "%s must be an absolute path, got: %s" context path)) 84 + (Fmt.str "%s must be an absolute path, got: %s" context path)) 86 85 87 86 let resolve_path fs home_path base_path = 88 87 if Filename.is_relative base_path then Eio.Path.(home_path / base_path) ··· 382 381 let doc = 383 382 match default_path with 384 383 | Some path -> 385 - Printf.sprintf 384 + Fmt.str 386 385 "Override %s directory. Can also be set with %s or %s. \ 387 386 Default: %s" 388 387 name app_env xdg_var path 389 388 | None -> 390 - Printf.sprintf 389 + Fmt.str 391 390 "Override %s directory. Can also be set with %s or %s. No \ 392 391 default value." 393 392 name app_env xdg_var ··· 562 561 let default_path = home ^ "/.cache/" ^ app_name in 563 562 564 563 let doc = 565 - Printf.sprintf 564 + Fmt.str 566 565 "Override cache directory. Can also be set with %s or %s. Default: %s" 567 566 app_env xdg_var default_path 568 567 in ··· 590 589 591 590 let env_docs app_name = 592 591 let app_upper = String.uppercase_ascii app_name in 593 - Printf.sprintf 592 + Fmt.str 594 593 {| 595 594 Configuration Precedence (follows standard Unix conventions): 596 595 1. Command-line flags (e.g., --config-dir) - highest priority