Skip to content

Commit

Permalink
Fix file copy crash (Switch broke)
Browse files Browse the repository at this point in the history
I don't like to do commits this small but my switch broke and I won't be able to do any testing until I fix it which means I can't update N-Xplorer for the time.
  • Loading branch information
CompSciOrBust committed Mar 8, 2020
1 parent ff01e73 commit c466aca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void RecursiveFileCopy(std::string SourcePath, std::string DestPath, std::string
while ((ent = readdir(dir)))
{
//Get path of file we want to copy
std::string PathToCopy = SourcePath + "/" +ent->d_name;
std::string PathToCopy = SourcePath + "/" + ent->d_name;
RecursiveFileCopy(PathToCopy.c_str(), NewDirPath.c_str(), ent->d_name);
}
closedir(dir);
Expand All @@ -239,9 +239,9 @@ void RecursiveFileCopy(std::string SourcePath, std::string DestPath, std::string
SourceFile.seekg (0);
//Create a 0.25 gb buffer
int Chunksize = 1024 * 1024 * 256;
char* Buffer = new char[Chunksize];
//If the file is smaller than the buffer change the chunk size
if(size < Chunksize) Chunksize = size;
char* Buffer = new char[Chunksize];
//Calculate how much of the file will be left over when split in to chunks
int LeftOvers = size % Chunksize;
while(SourceFile.tellg() != size - LeftOvers)
Expand Down

0 comments on commit c466aca

Please sign in to comment.