aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/src/main.cpp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-02-04 22:56:53 +0100
committerjaseg <git@jaseg.de>2021-02-04 22:56:53 +0100
commit6aab099baa7bab76d187f21b85e74848e25a8110 (patch)
treea096ca41d687786a6fff1fd30b0f93add7148461 /svg-flatten/src/main.cpp
parentbd2b0127409dd2dfdd1173c740e79034812d008c (diff)
downloadgerbolyze-6aab099baa7bab76d187f21b85e74848e25a8110.tar.gz
gerbolyze-6aab099baa7bab76d187f21b85e74848e25a8110.tar.bz2
gerbolyze-6aab099baa7bab76d187f21b85e74848e25a8110.zip
svg-flatten: Be even smarter locating usvg
Diffstat (limited to 'svg-flatten/src/main.cpp')
-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();