summaryrefslogtreecommitdiffstats
path: root/src/FileMgr.cpp
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-06-13 02:47:13 +0200
committerGitHub <noreply@github.com>2019-06-13 02:47:13 +0200
commit9689def6a59bd8a1d05860c7d23f1837cf3b4a80 (patch)
treecbd5cdfcb16bb993ca4b75552a48eab641541b77 /src/FileMgr.cpp
parentUpdate Replay.h (diff)
parentsilly mistake (diff)
downloadre3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.tar
re3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.tar.gz
re3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.tar.bz2
re3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.tar.lz
re3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.tar.xz
re3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.tar.zst
re3-9689def6a59bd8a1d05860c7d23f1837cf3b4a80.zip
Diffstat (limited to 'src/FileMgr.cpp')
-rw-r--r--src/FileMgr.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/FileMgr.cpp b/src/FileMgr.cpp
index 3aad9794..02c797ba 100644
--- a/src/FileMgr.cpp
+++ b/src/FileMgr.cpp
@@ -5,6 +5,8 @@
#include "patcher.h"
#include "FileMgr.h"
+const char *_psGetUserFilesFolder();
+
/*
* Windows FILE is BROKEN for GTA.
*
@@ -49,14 +51,17 @@ found:
return fd;
}
-static void
+static int
myfclose(int fd)
{
+ int ret;
assert(fd < NUMFILES);
if(myfiles[fd].file){
- fclose(myfiles[fd].file);
+ ret = fclose(myfiles[fd].file);
myfiles[fd].file = nil;
+ return ret;
}
+ return EOF;
}
static int
@@ -158,7 +163,8 @@ myfseek(int fd, long offset, int whence)
static int
myfeof(int fd)
{
- return feof(myfiles[fd].file);
+// return feof(myfiles[fd].file);
+ return ferror(myfiles[fd].file);
}
@@ -205,7 +211,7 @@ void
CFileMgr::SetDirMyDocuments(void)
{
SetDir(""); // better start at the root if user directory is relative
- chdir(GetUserDirectory());
+ chdir(_psGetUserFilesFolder());
}
int
@@ -265,10 +271,10 @@ CFileMgr::ReadLine(int fd, char *buf, int len)
return myfgets(buf, len, fd);
}
-void
+int
CFileMgr::CloseFile(int fd)
{
- myfclose(fd);
+ return myfclose(fd);
}
int