Skip to content

Commit

Permalink
Deprecating Cd in favor of -output-directory or Set Extraction Output…
Browse files Browse the repository at this point in the history
… Directory.

New attempt to Alizter's PR coq#16119.
  • Loading branch information
herbelin committed Mar 4, 2024
1 parent 08de550 commit d844ba7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/sphinx/addendum/extraction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ in the Coq sources.

.. cmd:: Cd {? @string }

.. deprecated:: 8.20

Use instead the command line option :n:`-output-directory` (see
:ref:`command-line-options`), or the :flag:`Extraction Output Directory`
option.

If :n:`@string` is specified, changes the current directory according to
:token:`string` which can be any valid path. Otherwise, it displays the
current directory as :cmd:`Pwd` does.
Expand Down
5 changes: 5 additions & 0 deletions vernac/synterp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,14 @@ let synterp_declare_ml_module ~local l =
let l = List.map expand l in
Mltop.declare_ml_modules local l

let warn_chdir = CWarnings.create ~name:"change-dir-deprecated" ~category:Deprecation.Version.v8_18
(fun () -> strbrk "Command \"Cd\" is deprecated." ++ spc () ++
strbrk "Use command-line \"-output-directory dir\" instead.")

let synterp_chdir = function
| None -> Feedback.msg_notice (str (Sys.getcwd()))
| Some path ->
warn_chdir ();
begin
try Sys.chdir (expand path)
with Sys_error err ->
Expand Down

0 comments on commit d844ba7

Please sign in to comment.