+
+int const FORMAT = 2;
+
+
+bool layout2layout(FileName const & filename, FileName const & tempfile)
+{
+ FileName const script = libFileSearch("scripts", "layout2layout.py");
+ if (script.empty()) {
+ lyxerr << "Could not find layout conversion "
+ "script layout2layout.py." << endl;
+ return false;
+ }
+
+ std::ostringstream command;
+ command << support::os::python() << ' ' << quoteName(script.toFilesystemEncoding())
+ << ' ' << quoteName(filename.toFilesystemEncoding())
+ << ' ' << quoteName(tempfile.toFilesystemEncoding());
+ string const command_str = command.str();
+
+ lyxerr[Debug::TCLASS] << "Running `" << command_str << '\'' << endl;
+
+ support::cmd_ret const ret =
+ support::runCommand(command_str);
+ if (ret.first != 0) {
+ lyxerr << "Could not run layout conversion "
+ "script layout2layout.py." << endl;
+ return false;
+ }
+ return true;
+}
+