mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
use CFileHelpers::copyFile instead of own function; cleanup helpers
Origin commit data
------------------
Commit: 6d01d59b53
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-11 (Thu, 11 Aug 2016)
Origin message was:
------------------
- use CFileHelpers::copyFile instead of own function; cleanup helpers
This commit is contained in:
@@ -59,9 +59,6 @@
|
||||
#include <eitd/sectionsd.h>
|
||||
#include <timerdclient/timerdclient.h>
|
||||
|
||||
//NI
|
||||
#include <system/helpers.h>
|
||||
|
||||
extern CPictureViewer * g_PicViewer;
|
||||
|
||||
#define ICON_LARGE_WIDTH 26
|
||||
@@ -1272,7 +1269,8 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
|
||||
else
|
||||
picname = imdb->getFilename(channel, epgData.eventID);
|
||||
|
||||
if (!File_copy(imdb->posterfile.c_str(), picname.c_str()))
|
||||
CFileHelpers fh;
|
||||
if (!fh.copyFile(imdb->posterfile.c_str(), picname.c_str()))
|
||||
perror( "IMDb: error copy file" );
|
||||
|
||||
sleep(2);
|
||||
|
@@ -1083,7 +1083,8 @@ void CInfoViewerBB::paint_cam_icons()
|
||||
int CInfoViewerBB::check_ecmInfo()
|
||||
{
|
||||
int caid = 0;
|
||||
if (File_copy("/tmp/ecm.info", "/tmp/ecm.info.tmp")) {
|
||||
CFileHelpers fh;
|
||||
if (fh.copyFile("/tmp/ecm.info", "/tmp/ecm.info.tmp")) {
|
||||
g_InfoViewer->md5_ecmInfo = filehash((char *)"/tmp/ecm.info.tmp");
|
||||
caid = parse_ecmInfo("/tmp/ecm.info.tmp");
|
||||
}
|
||||
|
@@ -911,8 +911,11 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
|
||||
printf("Poster\n");
|
||||
poster = m_movieSelectionHandler->file.Name.substr(0, pos);
|
||||
poster += ".jpg";
|
||||
File_copy(imdb->posterfile.c_str(), poster.c_str());
|
||||
printf("* poster: %s\n", poster.c_str());
|
||||
CFileHelpers fh;
|
||||
if (fh.copyFile(imdb->posterfile.c_str(), poster.c_str()))
|
||||
printf("* poster: %s\n", poster.c_str());
|
||||
else
|
||||
printf("* poster: copy error\n");
|
||||
}
|
||||
|
||||
//m_movieInfo.saveMovieInfo(*m_movieSelectionHandler);
|
||||
|
@@ -156,7 +156,8 @@ int CNIMenu::exec(CMenuTarget* parent, const std::string &actionkey)
|
||||
else if(actionkey == "ecmInfo") {
|
||||
|
||||
buffer=NULL;
|
||||
if (File_copy("/tmp/ecm.info", "/tmp/ecm.info.tmp"))
|
||||
CFileHelpers fhlp;
|
||||
if (fhlp.copyFile("/tmp/ecm.info", "/tmp/ecm.info.tmp"))
|
||||
{
|
||||
if ((fh = fopen("/tmp/ecm.info.tmp", "r")))
|
||||
{
|
||||
|
@@ -1110,44 +1110,7 @@ std::string Lang2ISO639_1(std::string& lang)
|
||||
}
|
||||
|
||||
//NI
|
||||
bool File_copy(std::string rstr, std::string wstr)
|
||||
{
|
||||
char * buffer;
|
||||
long size;
|
||||
|
||||
std::ifstream infile(rstr.c_str(), std::ifstream::binary);
|
||||
if (infile)
|
||||
{
|
||||
std::ofstream outfile(wstr.c_str(), std::ofstream::binary);
|
||||
if (outfile)
|
||||
{
|
||||
// get size of file
|
||||
infile.seekg(0,std::ifstream::end);
|
||||
size=infile.tellg();
|
||||
infile.seekg(0);
|
||||
|
||||
buffer = new char [size];
|
||||
infile.read (buffer,size);
|
||||
|
||||
outfile.write (buffer,size);
|
||||
|
||||
delete[] buffer;
|
||||
outfile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
infile.close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// rreturns the pid of the first process found in /proc
|
||||
// returns the pid of the first process found in /proc
|
||||
int getpidof(const char *process)
|
||||
{
|
||||
DIR *dp;
|
||||
|
@@ -122,10 +122,9 @@ std::string getJFFS2MountPoint(int mtdPos);
|
||||
std::string Lang2ISO639_1(std::string& lang);
|
||||
|
||||
//NI
|
||||
bool File_copy(std::string rstr, std::string wstr);
|
||||
int getpidof(const char *process);
|
||||
std::string filehash(const char * file);
|
||||
std::string get_path(const char * path);
|
||||
int getpidof(const char *process);
|
||||
std::string filehash(const char * file);
|
||||
std::string get_path(const char * path);
|
||||
inline bool file_exists(const std::string file) { return file_exists(file.c_str()); }
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user