-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
77 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#pragma once | ||
|
||
#include "graphics.hpp" | ||
#include "graphics/graphics.hpp" | ||
|
||
class avatoolState | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
void copyFile(const std::string &sourcePath, const std::string &destinationPath); | ||
void copyDirectory(const std::string &sourcePath, const std::string &destinationPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,4 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <dirent.h> | ||
|
||
class dirList | ||
{ | ||
public: | ||
void assign(const std::string& _path); | ||
void rescan(); | ||
|
||
std::string getItem(int index); | ||
bool isDir(int index); | ||
unsigned getCount(); | ||
|
||
private: | ||
DIR *d; | ||
struct dirent *ent; | ||
std::string path; | ||
std::vector<std::string> item; | ||
}; | ||
|
||
void copyFile(const std::string& from, const std::string& to); | ||
void copyDirToDir(const std::string& from, const std::string &to); | ||
void delDir(const std::string& path); | ||
#include "filesystem/directoryListing.hpp" | ||
#include "filesystem/io.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <fstream> | ||
#include <vector> | ||
#include <sys/stat.h> | ||
#include "filesystem/directoryListing.hpp" | ||
#include "filesystem/io.hpp" | ||
|
||
void copyFile(const std::string &sourcePath, const std::string &destinationPath) | ||
{ | ||
std::ifstream source(sourcePath, std::ios::binary); | ||
std::ofstream destination(destinationPath, std::ios::binary); | ||
|
||
// Since we're just dealing with jpegs, read whole thing to RAM then out | ||
std::vector<char> fileBuffer((std::istreambuf_iterator<char>(source)), std::istreambuf_iterator<char>()); | ||
destination.write(fileBuffer.data(), fileBuffer.size()); | ||
} | ||
|
||
void copyDirectory(const std::string &sourcePath, const std::string &destinationPath) | ||
{ | ||
directoryListing sourceList(sourcePath); | ||
|
||
int sourceCount = sourceList.getDirectoryListingCount(); | ||
for(int i = 0; i < sourceCount; i++) | ||
{ | ||
if(sourceList.itemAtIsDirectory(i)) | ||
{ | ||
//New paths | ||
std::string newSource = sourcePath + sourceList.getDirectoryItemAt(i) + "/"; | ||
std::string newDestination = destinationPath + sourceList.getDirectoryItemAt(i) + "/"; | ||
|
||
//Use substring to create sub directory | ||
mkdir(newDestination.substr(0, newDestination.npos - 1).c_str(), 0777); | ||
|
||
//Recursion | ||
copyDirectory(newSource, newDestination); | ||
} | ||
else | ||
{ | ||
//Full paths | ||
std::string fullSource = sourcePath + sourceList.getDirectoryItemAt(i); | ||
std::string fullDestination = destinationPath + sourceList.getDirectoryItemAt(i); | ||
|
||
//Copy it over | ||
copyFile(fullSource, fullDestination); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters