svg-flatten: Be even smarter locating usvg

wip
jaseg 2021-02-04 22:56:53 +01:00
rodzic bd2b012740
commit 6aab099baa
1 zmienionych plików z 15 dodań i 8 usunięć

Wyświetl plik

@ -340,18 +340,25 @@ int main(int argc, char **argv) {
}
string dpi_str = to_string(dpi);
const char *homedir;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
string homedir_s(homedir);
string loc_in_home = homedir_s + "/.cargo/bin/usvg";
const char *command_line[] = {nullptr, "--keep-named-groups", "--dpi", dpi_str.c_str(), barf.c_str(), frob.c_str(), NULL};
bool found_usvg = false;
int usvg_rc=-1;
for (int i=0; i<2; i++) {
const char *homedir;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
string homedir_s(homedir);
string loc_in_home = homedir_s + "/.cargo/bin/usvg";
for (int i=0; i<3; i++) {
const char *usvg_envvar;
if (i == 0) {
if ((usvg_envvar = getenv("USVG")) == NULL) {
continue;
} else {
command_line[0] = "usvg";
}
} else if (i == 1) {
command_line[0] = "usvg";
} else {
command_line[0] = loc_in_home.c_str();