[planetblupi] 01/29: Move the function to test if a file exists in misc
Didier Raboud
odyx at moszumanska.debian.org
Tue Jan 2 08:38:40 UTC 2018
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository planetblupi.
commit a058da17a3c4ff80fb9120e4f9198be3de1a15e2
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date: Sun Dec 10 15:29:11 2017 +0100
Move the function to test if a file exists in misc
---
src/event.cxx | 2 +-
src/misc.cxx | 14 ++++++++++++++
src/misc.h | 1 +
src/movie.cxx | 16 ----------------
4 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/event.cxx b/src/event.cxx
index 6938ab8..fe88eb8 100644
--- a/src/event.cxx
+++ b/src/event.cxx
@@ -4394,7 +4394,7 @@ CEvent::StartMovie (const std::string & pFilename)
if (!m_bMovie)
return false;
- if (!m_pMovie->IsExist (pFilename))
+ if (!FileExists (pFilename))
return false;
HideMouse (true);
diff --git a/src/misc.cxx b/src/misc.cxx
index 65ab8b4..de244e9 100644
--- a/src/misc.cxx
+++ b/src/misc.cxx
@@ -155,3 +155,17 @@ AddUserPath (std::string & pFilename)
pFilename = path;
SDL_free (temp);
}
+
+bool
+FileExists (const std::string & filename)
+{
+ const auto path = GetBaseDir () + filename;
+ FILE * file;
+
+ file = fopen (path.c_str (), "rb");
+ if (file == nullptr)
+ return false;
+
+ fclose (file);
+ return true;
+}
diff --git a/src/misc.h b/src/misc.h
index bfd519c..db50f86 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -37,6 +37,7 @@ std::string GetBaseDir ();
std::string GetShareDir ();
std::string GetLocale ();
extern void AddUserPath (std::string & pFilename);
+bool FileExists (const std::string & filename);
template <typename... Args>
std::string
diff --git a/src/movie.cxx b/src/movie.cxx
index a7172bf..085211c 100644
--- a/src/movie.cxx
+++ b/src/movie.cxx
@@ -191,22 +191,6 @@ CMovie::GetEnable ()
return m_bEnable;
}
-// Indique si un film existe.
-
-bool
-CMovie::IsExist (const std::string & pFilename)
-{
- const auto path = GetBaseDir () + pFilename;
- FILE * file;
-
- file = fopen (path.c_str (), "rb");
- if (file == nullptr)
- return false;
-
- fclose (file);
- return true;
-}
-
// Montre un film avi.
bool
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git
More information about the Pkg-games-commits
mailing list