mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Utility functions for converting preference files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37230 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4f4a8203b3
commit
0e2828917b
@ -977,5 +977,32 @@ int compare_timestamps(FileName const & file1, FileName const & file2)
|
||||
}
|
||||
|
||||
|
||||
bool prefs2prefs(FileName const & filename, FileName const & tempfile, bool lfuns)
|
||||
{
|
||||
FileName const script = libFileSearch("scripts", "prefs2prefs.py");
|
||||
if (script.empty()) {
|
||||
LYXERR0("Could not find bind file conversion "
|
||||
"script prefs2prefs.py.");
|
||||
return false;
|
||||
}
|
||||
|
||||
ostringstream command;
|
||||
command << os::python() << ' ' << quoteName(script.toFilesystemEncoding())
|
||||
<< ' ' << (lfuns ? "-l" : "-p") << ' '
|
||||
<< quoteName(filename.toFilesystemEncoding())
|
||||
<< ' ' << quoteName(tempfile.toFilesystemEncoding());
|
||||
string const command_str = command.str();
|
||||
|
||||
LYXERR(Debug::FILES, "Running `" << command_str << '\'');
|
||||
|
||||
cmd_ret const ret = runCommand(command_str);
|
||||
if (ret.first != 0) {
|
||||
LYXERR0("Could not run bind file conversion script prefs2prefs.py.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} //namespace support
|
||||
} // namespace lyx
|
||||
|
@ -268,6 +268,10 @@ std::string const readBB_from_PSFile(FileName const & file);
|
||||
*/
|
||||
int compare_timestamps(FileName const & file1, FileName const & file2);
|
||||
|
||||
/// \param lfuns: true if we're converting lfuns, false if prefs
|
||||
bool prefs2prefs(FileName const & filename, FileName const & tempfile,
|
||||
bool lfuns);
|
||||
|
||||
typedef std::pair<int, std::string> cmd_ret;
|
||||
|
||||
cmd_ret const runCommand(std::string const & cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user