#include <config.h>
+#include "LyXRC.h"
+
#include "support/filetools.h"
#include "support/debug.h"
}
+FileName const imageLibFileSearch(string & dir, string const & name,
+ string const & ext)
+{
+ if (!lyx::lyxrc.icon_set.empty()) {
+ string const imagedir = addPath(dir, lyx::lyxrc.icon_set);
+ FileName const fn = libFileSearch(imagedir, name, ext);
+ if (fn.exists()) {
+ dir = imagedir;
+ return fn;
+ }
+ }
+ return libFileSearch(dir, name, ext);
+}
+
+
string const libScriptSearch(string const & command_in, quote_style style)
{
static string const token_scriptpath = "$$s/";
static regex envvar_br_re("(.*)" + envvar_br + "(.*)");
static regex envvar_re("(.*)" + envvar + "(.*)");
- smatch what;
- string result;
- string remaining = path;
+ string result = path;
while (1) {
- regex_match(remaining, what, envvar_br_re);
- if (!what[0].matched) {
- regex_match(remaining, what, envvar_re);
- if (!what[0].matched) {
- result += remaining;
+ smatch what;
+ if (!regex_match(result, what, envvar_br_re)) {
+ if (!regex_match(result, what, envvar_re))
break;
- }
}
string env_var = getEnv(what.str(2));
- if (!env_var.empty())
- result += what.str(1) + env_var;
- else
- result += what.str(1) + "$" + what.str(2);
- remaining = what.str(3);
+ result = what.str(1) + env_var + what.str(3);
}
return result;
}