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
|
From: Mehdi Dogguy <mehdi@debian.org>
Date: Sun, 21 Feb 2021 10:39:55 +0100
Subject: Use HOME env variable instead of ~
---
src/client/opamAdminCommand.ml | 3 ++-
src/client/opamAdminRepoUpgrade.ml | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/client/opamAdminCommand.ml b/src/client/opamAdminCommand.ml
index 65a1afb..db797f9 100644
--- a/src/client/opamAdminCommand.ml
+++ b/src/client/opamAdminCommand.ml
@@ -281,7 +281,8 @@ let add_hashes_command_doc =
let add_hashes_command cli =
let command = "add-hashes" in
let doc = add_hashes_command_doc in
- let cache_dir = OpamFilename.Dir.of_string "~/.cache/opam-hash-cache" in
+ let home = try Sys.getenv "HOME" with Not_found -> Sys.getcwd () in
+ let cache_dir = OpamFilename.Dir.of_string (Filename.concat home "/.cache/opam-hash-cache") in
let man = [
`S Manpage.s_description;
`P (Printf.sprintf
diff --git a/src/client/opamAdminRepoUpgrade.ml b/src/client/opamAdminRepoUpgrade.ml
index b3af2e5..93c0ce6 100644
--- a/src/client/opamAdminRepoUpgrade.ml
+++ b/src/client/opamAdminRepoUpgrade.ml
@@ -145,8 +145,9 @@ let all_base_packages =
])
let cache_file : string list list OpamFile.t =
+ let home = try Sys.getenv "HOME" with Not_found -> Sys.getcwd () in
OpamFile.make @@
- OpamFilename.of_string "~/.cache/opam-compilers-to-packages/url-hashes"
+ OpamFilename.of_string (Filename.concat home "/.cache/opam-compilers-to-packages/url-hashes")
let do_upgrade repo_root =
let write_opam ?(add_files=[]) opam =
|