Fixed issue where stock cover art was not correctly being copied

This commit is contained in:
kdeng00
2019-08-11 16:10:18 -04:00
parent ea25480ad1
commit 023c467a9d
+7 -11
View File
@@ -2,6 +2,7 @@
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <sstream>
#include "directory_manager.h" #include "directory_manager.h"
@@ -43,19 +44,14 @@ std::string read_cover_art(const char *source)
std::fstream cov(source, std::ios::in | std::ios::binary); std::fstream cov(source, std::ios::in | std::ios::binary);
if (!cov.is_open()) { cov.seekg(0);
std::cout<<"file is not open"<<std::endl;
}
cov.seekg(0, cov.end); std::stringstream buf;
int cov_len = cov.tellg(); std::copy(std::istreambuf_iterator<char>(cov),
cov.seekg(0, cov.beg); std::istreambuf_iterator<char>(),
std::ostreambuf_iterator<char>(buf));
char buff[cov_len]; return buf.str();
cov.read(buff, cov_len);
cov.close();
return std::string{buff};
} }
void copy_stock_to_root(const char *target, const std::string buff) void copy_stock_to_root(const char *target, const std::string buff)
{ {