mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Move the function to test if a file exists in misc
This commit is contained in:
parent
5c92d14c51
commit
a058da17a3
@ -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);
|
||||
|
14
src/misc.cxx
14
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user