Browse Source

- fixed get_all_relative_paths()

master
Andreas Romeyke 2 years ago
parent
commit
0040d0c660
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      src/lib/payload.cpp

+ 5
- 4
src/lib/payload.cpp View File

@ -9,7 +9,7 @@
namespace fs = boost::filesystem;
using namespace std;
Payload::Payload( string basedir ) {
this->basedir = basedir + "data/";
this->basedir = basedir;
fs::path p{ this->basedir };
fs::file_status s = fs::status( p );
// cout << "basedir "<< p.string() << endl;
@ -29,12 +29,13 @@ void Payload::scan_dir_recursively( fs::path directory, list<fs::path> &paths) {
list<string> Payload::get_all_relative_paths() {
list<fs::path> paths;
list<string> strpaths;
fs::path directory(this->basedir);
fs::path directory(this->basedir + "/data");
Payload::scan_dir_recursively( directory, paths);
list<fs::path>::iterator i;
for (i=paths.begin(); i!= paths.end(); i++) {
if (fs::is_regular_file( *i )) {
strpaths.push_back( (*i).relative_path().string() );
fs::path relpath = fs::relative((*i), this->basedir);
strpaths.push_back( relpath.string() );
}
}
return strpaths;
@ -43,7 +44,7 @@ list<string> Payload::get_all_relative_paths() {
list<string> Payload::get_all_absolute_paths() {
list<fs::path> paths;
list<string> strpaths;
fs::path directory(this->basedir);
fs::path directory(this->basedir + "/data");
Payload::scan_dir_recursively( directory, paths);
list<fs::path>::iterator i;
for (i=paths.begin(); i!= paths.end(); i++) {


Loading…
Cancel
Save