make QFS_CreatePath work again and remove some old code from QFS_WriteFile

This commit is contained in:
Bill Currie 2003-05-30 01:44:39 +00:00
parent 016743c3ab
commit f061c47242

View file

@ -575,7 +575,6 @@ QFS_Path_f (void)
void void
QFS_WriteFile (const char *filename, void *data, int len) QFS_WriteFile (const char *filename, void *data, int len)
{ {
char name[MAX_OSPATH];
QFile *f; QFile *f;
f = QFS_WOpen (filename, 0); f = QFS_WOpen (filename, 0);
@ -583,7 +582,6 @@ QFS_WriteFile (const char *filename, void *data, int len)
Sys_Error ("Error opening %s", filename); Sys_Error ("Error opening %s", filename);
} }
Sys_Printf ("QFS_WriteFile: %s\n", name);
Qwrite (f, data, len); Qwrite (f, data, len);
Qclose (f); Qclose (f);
} }
@ -626,8 +624,9 @@ void
QFS_CreatePath (const char *path) QFS_CreatePath (const char *path)
{ {
char *ofs; char *ofs;
char e_path[MAX_OSPATH]; char *e_path = alloca (strlen (path) + 1);
strcpy (e_path, path);
for (ofs = e_path + 1; *ofs; ofs++) { for (ofs = e_path + 1; *ofs; ofs++) {
if (*ofs == '/') { // create the directory if (*ofs == '/') { // create the directory
*ofs = 0; *ofs = 0;
@ -1282,6 +1281,7 @@ QFS_Open (const char *path, const char *mode)
QFile *file; QFile *file;
dsprintf (full_path, "%s/%s", qfs_userpath, path); dsprintf (full_path, "%s/%s", qfs_userpath, path);
Sys_DPrintf ("QFS_Open: %s %s\n", full_path->str, mode);
QFS_CreatePath (full_path->str); QFS_CreatePath (full_path->str);
file = Qopen (full_path->str, mode); file = Qopen (full_path->str, mode);
dstring_delete (full_path); dstring_delete (full_path);