user-home-res-dir.patch 904 B

1234567891011121314151617181920212223242526272829303132
  1. --- a/src/Libraries/RES/Source/caseless.c
  2. +++ b/src/Libraries/RES/Source/caseless.c
  3. @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
  4. // DG 2018: a case-insensitive fopen() wrapper, and functions used by it
  5. +#include <stdlib.h>
  6. #include <assert.h>
  7. #include <string.h>
  8. #include <stdio.h>
  9. @@ -239,12 +240,18 @@ int caselesspath(const char *inpath, char *outpath, int wantdir) {
  10. #endif // not Windows
  11. }
  12. -FILE *fopen_caseless(const char *path, const char *mode) {
  13. +FILE *fopen_caseless(const char *xpath, const char *mode) {
  14. FILE *ret = NULL;
  15. - if (path == NULL || mode == NULL)
  16. + if (xpath == NULL || mode == NULL)
  17. return NULL;
  18. +//XXX
  19. + const int XSIZE = 500;
  20. + char path[XSIZE];
  21. + snprintf( path, XSIZE, "%s/.systemshock/%s", getenv("HOME"), xpath );
  22. +//XXX
  23. +
  24. ret = fopen(path, mode);
  25. #ifndef _WIN32 // not windows