From c02a072f11683914ce9dbe77adf0b478f613885e Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Mon, 2 Dec 2013 20:22:01 -0700
Subject: Fix directory and include issues


diff --git a/source/Grepper.cpp b/source/Grepper.cpp
index d2e5c58..71befc8 100644
--- a/source/Grepper.cpp
+++ b/source/Grepper.cpp
@@ -139,8 +139,10 @@ int32 Grepper::GrepperThread()
 	char command[B_PATH_NAME_LENGTH + 32];
 
 	BPath tempFile;
-	sprintf(fileName, "/boot/var/tmp/TrackerGrep%ld", fThreadId);
-	tempFile.SetTo(fileName);
+	if (find_directory(B_SYSTEM_TEMP_DIRECTORY, &tempFile, true) != B_OK)
+		return -1;
+	sprintf(fileName, "TrackerGrep%ld", fThreadId);
+	tempFile.Append(fileName);
 
 	while (!fMustQuit && GetNextName(fileName)) {
 		message.MakeEmpty();
@@ -159,8 +161,9 @@ int32 Grepper::GrepperThread()
 
 		EscapeSpecialChars(fileName);
 
+		//assume that grep is already in $PATH
 		sprintf(
-			command, "/boot/beos/bin/grep -hn %s %s \"%s\" > \"%s\"",
+			command, "grep -hn %s %s \"%s\" > \"%s\"",
 			fModel->fCaseSensitive ? "" : "-i", fPattern, fileName, 
 			tempFile.Path());
 
diff --git a/source/Model.h b/source/Model.h
index a73d801..8ec1d24 100644
--- a/source/Model.h
+++ b/source/Model.h
@@ -30,6 +30,7 @@
 #include <Message.h>
 #include <Entry.h>
 #include <FindDirectory.h>
+#include <File.h>
 #include <Rect.h>
 
 #define PREFS_FILE    "TrackerGrepSettings"
-- 
1.8.3.4

