mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
Modify LibScriptSearch to replace "$$s/" with an appropriate path.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7070 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
00495d0c10
commit
a565043e68
@ -1,3 +1,9 @@
|
|||||||
|
2003-05-30 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* filetools.C (LibScriptSearch): make it search for "$$s/" and replace
|
||||||
|
this with the path to the script. If the script is not found, the "$$s/"
|
||||||
|
string is removed.
|
||||||
|
|
||||||
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
|
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* lstrings.[Ch] (prefixIs,suffixIs,subst): remove variants taking
|
* lstrings.[Ch] (prefixIs,suffixIs,subst): remove variants taking
|
||||||
|
@ -333,18 +333,35 @@ i18nLibFileSearch(string const & dir, string const & name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const LibScriptSearch(string const & command)
|
string const LibScriptSearch(string const & command_in)
|
||||||
{
|
{
|
||||||
string script;
|
string const token_scriptpath("$$s/");
|
||||||
string args = command;
|
|
||||||
args = split(args, script, ' ');
|
string command = command_in;
|
||||||
script = LibFileSearch("scripts", script);
|
// Find the starting position of "$$s/"
|
||||||
if (script.empty())
|
string::size_type const pos1 = command.find(token_scriptpath);
|
||||||
|
if (pos1 == string::npos)
|
||||||
return command;
|
return command;
|
||||||
else if (args.empty())
|
// Find the end of the "$$s/some_script" word within command
|
||||||
return script;
|
string::size_type const start_script = pos1 + 4;
|
||||||
else
|
string::size_type const pos2 = command.find(' ', start_script);
|
||||||
return script + ' ' + args;
|
string::size_type const size_script = pos2 == string::npos?
|
||||||
|
(command.size() - start_script) : pos2 - start_script;
|
||||||
|
|
||||||
|
// Does this script file exist?
|
||||||
|
string const script =
|
||||||
|
LibFileSearch("scripts", command.substr(start_script, size_script));
|
||||||
|
|
||||||
|
if (script.empty()) {
|
||||||
|
// Replace "$$s/" with ""
|
||||||
|
command.erase(pos1, 4);
|
||||||
|
} else {
|
||||||
|
// Replace "$$s/some_script" with "$LYX_SCRIPT_PATH/some_script"
|
||||||
|
string::size_type const size_replace = size_script + 4;
|
||||||
|
command.replace(pos1, size_replace, script);
|
||||||
|
}
|
||||||
|
|
||||||
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user