summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2017-06-13 18:24:42 +0200
committerBardur Arantsson <bardur@scientician.net>2017-06-13 18:24:42 +0200
commit1fb9b3961781e5bca533c6876615cb67d5a455b0 (patch)
treea0fe757628985473b6a2e7662eaa27c80fa574a7 /src
parent7a98afaeee09141ab36607e898d0e00072d9d930 (diff)
Use boost::fs::exists() instead of "homebaked" file_exist()
Diffstat (limited to 'src')
-rw-r--r--src/loadsave.cc24
-rw-r--r--src/loadsave.hpp1
-rw-r--r--src/squeltch.cc2
3 files changed, 3 insertions, 24 deletions
diff --git a/src/loadsave.cc b/src/loadsave.cc
index fc473e0c..541fbbec 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -38,6 +38,7 @@
#include "xtra2.hpp"
#include "z-rand.hpp"
+#include <boost/filesystem.hpp>
#include <cassert>
#include <fmt/format.h>
#include <memory>
@@ -1478,27 +1479,6 @@ void save_dungeon()
my_fclose(fff);
}
-bool_ file_exist(cptr buf)
-{
- int fd;
- bool_ result;
-
- /* Open savefile */
- fd = fd_open(buf, O_RDONLY);
-
- /* File exists */
- if (fd >= 0)
- {
- fd_close(fd);
- result = TRUE;
- }
- else
- result = FALSE;
-
- return result;
-}
-
-
/*
* Handle monster lore
*/
@@ -2540,7 +2520,7 @@ bool_ load_player()
/* XXX XXX XXX Fix this */
/* Verify the existance of the savefile */
- if (!file_exist(savefile))
+ if (!boost::filesystem::exists(savefile))
{
/* Give a message */
msg_format("Savefile does not exist: %s", savefile);
diff --git a/src/loadsave.hpp b/src/loadsave.hpp
index 01a3cb87..d28d437e 100644
--- a/src/loadsave.hpp
+++ b/src/loadsave.hpp
@@ -2,6 +2,5 @@
#include "h-basic.h"
-bool_ file_exist(cptr buf);
bool_ load_dungeon(char *ext);
bool_ load_player();
diff --git a/src/squeltch.cc b/src/squeltch.cc
index 61ccb1f3..1db8ff74 100644
--- a/src/squeltch.cc
+++ b/src/squeltch.cc
@@ -197,7 +197,7 @@ static void automatizer_save_rules()
// Build the filename
path_build(buf, 1024, ANGBAND_DIR_USER, name.c_str());
- if (file_exist(buf))
+ if (boost::filesystem::exists(buf))
{
show_message("File exists, continue? [y/n]");
ch = inkey();