From 1fb9b3961781e5bca533c6876615cb67d5a455b0 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Tue, 13 Jun 2017 18:24:42 +0200 Subject: Use boost::fs::exists() instead of "homebaked" file_exist() --- src/loadsave.cc | 24 ++---------------------- src/loadsave.hpp | 1 - src/squeltch.cc | 2 +- 3 files changed, 3 insertions(+), 24 deletions(-) (limited to 'src') 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 #include #include #include @@ -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(); -- cgit v1.2.3