summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/misc.c b/src/misc.c
index 338737007..9b535b1ab 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -27,6 +27,21 @@ struct arc4_stream {
/*************************************************************************/
+/** Check if a file exists
+ * @param filename The file
+ * @return true if the file exists, false if it doens't
+ */
+bool IsFile(const std::string &filename)
+{
+ struct stat fileinfo;
+ if (!stat(filename.c_str(), &fileinfo))
+ {
+ return true;
+ }
+
+ return false;
+}
+
/**
* toupper: Like the ANSI functions, but make sure we return an
* int instead of a (signed) char.