summaryrefslogtreecommitdiff
path: root/src/common/utils.c
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-30 18:02:54 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-30 18:02:54 +0000
commit0b3a25080b95770f5447a0dbde4625d122b31fb3 (patch)
treec501015d8b6c3148339c16d4e447ab4b1408220d /src/common/utils.c
parent80907412c396e576da0a7fbdc3c6babbb2c16c02 (diff)
downloadhercules-0b3a25080b95770f5447a0dbde4625d122b31fb3.tar.gz
hercules-0b3a25080b95770f5447a0dbde4625d122b31fb3.tar.bz2
hercules-0b3a25080b95770f5447a0dbde4625d122b31fb3.tar.xz
hercules-0b3a25080b95770f5447a0dbde4625d122b31fb3.zip
* Moved function 'exists' (file presense check) to utils.c, so that it is available to code outside of lock.c
- Fixed associated F_OK and R_OK defines causing 'already defined' warnings on MinGW (since r1361). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14528 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/utils.c')
-rw-r--r--src/common/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/utils.c b/src/common/utils.c
index c1128edb4..12123784f 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -14,7 +14,11 @@
#include <math.h> // floor()
#ifdef WIN32
+ #include <io.h>
#include <windows.h>
+ #ifndef F_OK
+ #define F_OK 0x0
+ #endif /* F_OK */
#else
#include <unistd.h>
#include <dirent.h>
@@ -182,6 +186,11 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
}
#endif
+bool exists(const char* filename)
+{
+ return !access(filename, F_OK);
+}
+
uint8 GetByte(uint32 val, int idx)
{
switch( idx )