diff --git a/src/resourcefiles/file_directory.cpp b/src/resourcefiles/file_directory.cpp
index f2bf77ae3f..cb250ed1e8 100644
--- a/src/resourcefiles/file_directory.cpp
+++ b/src/resourcefiles/file_directory.cpp
@@ -208,7 +208,9 @@ int FDirectory::AddDirectory(const char *dirpath)
 
 int FDirectory::AddDirectory(const char *dirpath)
 {
-	char *argv [2] = {dirpath, NULL };
+	char *argv [2] = {NULL, NULL };
+	argv[0] = new char[strlen(dirpath)+1];
+	strcpy(argv[0], dirpath);
 	FTS *fts;
 	FTSENT *ent;
 	int count = 0;
@@ -216,7 +218,7 @@ int FDirectory::AddDirectory(const char *dirpath)
 	fts = fts_open(argv, FTS_LOGICAL, NULL);
 	if (fts == NULL)
 	{
-		Printf "Failed to start directory traversal: %s\n", strerror(errno));
+		Printf("Failed to start directory traversal: %s\n", strerror(errno));
 		return NULL;
 	}
 	while ((ent = fts_read(fts)) != NULL)
@@ -240,6 +242,7 @@ int FDirectory::AddDirectory(const char *dirpath)
 		count++;
 	}
 	fts_close(fts);
+	delete[] argv[0];
 	return count;
 }
 #endif
diff --git a/src/resourcefiles/resourcefile.h b/src/resourcefiles/resourcefile.h
index 03a0be4d88..bc07426e9f 100644
--- a/src/resourcefiles/resourcefile.h
+++ b/src/resourcefiles/resourcefile.h
@@ -61,7 +61,7 @@ private:
 
 public:
 	static FResourceFile *OpenResourceFile(const char *filename, FileReader *file, bool quiet = false);
-	static FResourceFile *FResourceFile::OpenDirectory(const char *filename);
+	static FResourceFile *OpenDirectory(const char *filename);
 	virtual ~FResourceFile();
 	FileReader *GetReader() const { return Reader; }
 	DWORD LumpCount() const { return NumLumps; }