Group :: Games/Boards
RPM: foobillard
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: foobillard-datadir.patch
Download
Download
diff -uNr foobillard.old/png_loader.c foobillard/png_loader.c
--- foobillard.old/png_loader.c Wed Mar 27 13:34:43 2002
+++ foobillard/png_loader.c Wed Mar 27 13:37:03 2002
@@ -25,6 +25,10 @@
#define COMPILE_PNG_CODE 0
#endif
+#ifndef DATADIR
+#define DATADIR "./"
+#endif
+
#if COMPILE_PNG_CODE
#include <png.h>
#else
@@ -47,7 +51,15 @@
char * buff;
char ** row_pointers;
- fp = fopen(file_name, "rb");
+ char *real_file_name;
+
+ real_file_name = malloc(strlen(DATADIR) + strlen(file_name) + 1);
+
+ strncpy(real_file_name, DATADIR, strlen(DATADIR) + 1);
+
+ strncat(real_file_name, file_name, strlen(file_name) + 1);
+
+ fp = fopen(real_file_name, "rb");
if (!fp){
return 0;
}
@@ -134,6 +146,7 @@
free(row_pointers);
free(info_ptr);
free(png_ptr);
+ free(real_file_name);
fclose(fp);