Stefan Schuermans
implement common sound dir, add some sounds
Stefan Schuermans commited 9eeb24a at 2019-09-01 13:45:33
/* Blinker
Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
a blinkenarea.org project */
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "File.h"
#include "Time.h"
namespace Blinker {
/**
* @brief constructor from path
* @param[in] path path to file
*/
File::File(const std::string &path):
m_path(path)
{
// get modification time
checkModified();
}
/**
* @brief get path to file
* @return path to file
*/
const std::string & File::getPath() const
{
return m_path;
}
/**
* @brief check if file exists
* @return whether file exists
*/
bool File::exists() const
{
struct stat s;
if (stat(m_path.c_str(), &s)) {
return false; // stat failed -> no such file
}
return true; // stat worked -> file exists
}
/**
* @brief check if file has been modified
* @return if file has been modified since last check
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX