WSL/SLF GitLab Repository

Commit 5fb2f44a authored by Thomas Egger's avatar Thomas Egger
Browse files

Added a platform independent copy_file(src,dest) procedure to the IOUtils namespace.

parent 688170a7
......@@ -75,6 +75,25 @@ void IOUtils::stripComments(std::string& str)
void IOUtils::copy_file(const std::string& src, const std::string& dest)
if (src == dest) return; //copying to the same file doesn't make sense, but is no crime either
std::ifstream fin(src.c_str(), std::ios::binary);
if ( throw FileAccessException(src, AT);
std::ofstream fout(dest.c_str(), std::ios::binary);
if ( {
throw FileAccessException(dest, AT);
fout << fin.rdbuf();
std::string IOUtils::cleanPath(const std::string& in_path) {
std::string out_path(in_path);
......@@ -89,6 +89,14 @@ namespace IOUtils {
unsigned int seek(const Date& soughtdate, const std::vector<MeteoData>& vecM, const bool& exactmatch=true);
* @brief Copies a files from one location to another
* @author Thomas Egger
* @param src The filename of the file to be copied
* @param dest The filename of the file to copy to (will be created or overwritten)
void copy_file(const std::string& src, const std::string& dest);
* @brief Converts a compass bearing to a trigonometric angle
* @param bearing compass bearing (0° on top, clockwise, in [0°, 360°[)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment