aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svg-flatten/src/main.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/svg-flatten/src/main.cpp b/svg-flatten/src/main.cpp
index 53ce19b..2b996f3 100644
--- a/svg-flatten/src/main.cpp
+++ b/svg-flatten/src/main.cpp
@@ -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();