Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update copy.h #633

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/chia/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@
#include <cstdio>
#include <cstdint>

#include <filesystem>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that has created many problems before, gotta souround all of it with #ifdef __linux__

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, no real programming experience so forgive my terrible coding...

namespace fs = std::filesystem;

inline
uint64_t copy_file(const std::string& src_path, const std::string& dst_path)
{
int plotsize = 109000000000
fs::space_info tmp = fs::space(dst_path);
if(tmp.available < plotsize) {
throw std::runtime_error("Destination does not have enough available disk space left");
}
FILE* src = fopen(src_path.c_str(), "rb");
if(!src) {
throw std::runtime_error("fopen() failed");
Expand Down