quote spaces in -I options
authorTony Cook <tony@develop-help.com>
Tue, 22 Nov 2011 09:15:39 +0000 (20:15 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 22 Nov 2011 09:15:39 +0000 (20:15 +1100)
.gitignore
Makefile.PL

index 20fb56fb9d553bfb0a91b1e5ed9da324d0466eaf..35c27c9adb2ddf2045236a67b59877c8ce58e15e 100644 (file)
@@ -14,4 +14,4 @@ pm_to_blib
 *~
 MANIFEST.bak
 Imager-Screenshot-*
-
+Screenshot_def.old
index 50cf6f88b02260e9b51951f1827f073e55559c8b..2417bd992c6323a1cb9c99ed0f849cd9b2181371 100644 (file)
@@ -165,12 +165,22 @@ sub _find_file {
   grep -f File::Spec->catfile($_, $name), @where;
 }
 
+sub _quote_spaces {
+  my $path = shift;
+
+  if ($path =~ / /) {
+    return qq("$path");
+  }
+
+  return $path;
+}
+
 sub find_header {
   my ($name, $description) = @_;
   my @found = _find_file($_[0], header_search_path());
 
   if (@found) {
-    push @cflags, "-I$_" for grep !$seen_incdir{$_}, @found;
+    push @cflags, _quote_spaces("-I$_") for grep !$seen_incdir{$_}, @found;
     @seen_incdir{@found} = (1) x @found;
   }
   else {