add wakeup_hdd & file_exists to system-helpers

Origin commit data
------------------
Branch: ni/coolstream
Commit: c6ae7255ac
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-09-11 (Tue, 11 Sep 2012)

Origin message was:
------------------
-add wakeup_hdd & file_exists to system-helpers

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2012-09-11 20:35:47 +02:00
parent 4d7752964c
commit 7e4fd63bf2
9 changed files with 42 additions and 28 deletions

View File

@@ -32,9 +32,33 @@
#include <sys/types.h>
#include <sys/vfs.h> /* or <sys/statfs.h> */
#include <string.h>
#include <fcntl.h>
#include <system/helpers.h>
bool file_exists(const char *filename)
{
struct stat stat_buf;
if(::stat(filename, &stat_buf) == 0)
{
return true;
} else
{
return false;
}
}
void wakeup_hdd(const char *hdd_dir)
{
if(!check_dir(hdd_dir)){
std::string wakeup_file = hdd_dir;
wakeup_file += "/.wakeup";
remove(wakeup_file.c_str());
creat(wakeup_file.c_str(),S_IREAD|S_IWRITE);
sync();
}
}
int my_system(const char * cmd, const char * arg1, const char * arg2)
{
int i;