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 20fb56f..35c27c9 100644 (file)
@@ -14,4 +14,4 @@ pm_to_blib
 *~
 MANIFEST.bak
 Imager-Screenshot-*
-
+Screenshot_def.old
index 50cf6f8..2417bd9 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 {