export code relatively to master directory
authorhaftmann
Thu, 19 Jul 2012 22:21:59 +0200
changeset 48371 3a5a5a992519
parent 48358 04fed0cf775a
child 48372 868dc809c8a2
export code relatively to master directory
NEWS
src/Tools/Code/code_target.ML
--- a/NEWS	Thu Jul 19 20:52:17 2012 +0200
+++ b/NEWS	Thu Jul 19 22:21:59 2012 +0200
@@ -15,6 +15,11 @@
 
 *** Pure ***
 
+* Command "export_code": relative file names are interpreted
+relatively to master directory of current theory rather than
+the rather arbitrary current working directory.
+INCOMPATIBILITY.
+
 * Discontinued obsolete attribute "COMP".  Potential INCOMPATIBILITY,
 use regular rule composition via "OF" / "THEN", or explicit proof
 structure instead.  Note that Isabelle/ML provides a variety of
--- a/src/Tools/Code/code_target.ML	Thu Jul 19 20:52:17 2012 +0200
+++ b/src/Tools/Code/code_target.ML	Thu Jul 19 22:21:59 2012 +0200
@@ -373,10 +373,13 @@
 fun assert_module_name "" = error ("Empty module name not allowed.")
   | assert_module_name module_name = module_name;
 
+fun using_master_directory thy = Option.map (Path.append (Thy_Load.master_directory thy));
+
 in
 
 fun export_code_for thy some_path target some_width module_name args =
-  export some_path ooo invoke_serializer thy target some_width module_name args;
+  export (using_master_directory thy some_path)
+  ooo invoke_serializer thy target some_width module_name args;
 
 fun produce_code_for thy target some_width module_name args =
   let