hell_fire 0 Posted May 9, 2004 heres a patch for the tolower program, checks for the exact filename of "flashpoint.cfg" (case sensitive) in the current directory before converting filenames. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> --- tolower.c.orig 2004-05-09 16:57:56.000000000 +1000 +++ tolower.c 2004-05-09 17:15:03.000000000 +1000 @@ -14,6 +14,7 @@ #include <sys/stat.h> #include <dirent.h> #include <unistd.h> +#include <fcntl.h> #include <string.h> #include <ctype.h> @@ -88,6 +89,18 @@ { /* TODO: command-line argument: directory to convert */ /* TODO: -v (verbose) */ + + /* Sanity check added by Adam Smith (Hell_Fire) */ + int fd; + fd = open("./flashpoint.cfg", O_RDONLY); + if (fd == -1) { + printf("Error: The file \"flashpoint.cfg\" does not exist in current directory.\nSanity check failed, exiting\n"); + exit(1); + } else { + close (fd); + } + /* Sanity check complete */ + int converted = convertDirectory("."); if ( converted <= 0 ) printf("No file-names were converted\n"); Simply put this into a file in the OFP directory (eg, tolower.patch), run the command "patch -i tolower.patch", then rebuild the executable using "gcc tolower.c -o tolower" Enjoy (this patch is classified under the GPL if anyone has any problems :P Its to small for me to care really) Share this post Link to post Share on other sites
benu 1 Posted May 9, 2004 Actually, i have tolower in another dir which is in my command path (my ofp folder isn't) and use it in different folders than the ofp folder also, eg lower filenames of addons BERFORE installing them instead of letting tolower run over the whole ofp installation repeatedly. But i guess there will be others that do have uses for this. Nice work nervertheless. Share this post Link to post Share on other sites