Skip to content

Commit

Permalink
Fix the output directory code.
Browse files Browse the repository at this point in the history
It wasn't taking into account any directories in the input file name.
  • Loading branch information
hainesr committed Dec 4, 2015
1 parent 057fc6d commit 107d466
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ void draw_bbox_centre(Mat frame, vector<float> bbox) {
}

string output_filename(string input_filename, string output_dir="") {
int dot = input_filename.find_last_of('.');
int out_len = output_dir.length();

if(out_len > 0 && !(0 == output_dir.compare((out_len - 1), 1, "/"))) {
output_dir += '/';
if(out_len > 0) {
int slash = input_filename.find_last_of('/');
input_filename = input_filename.substr(slash + 1);

if(!(0 == output_dir.compare((out_len - 1), 1, "/"))) {
output_dir += '/';
}
}

int dot = input_filename.find_last_of('.');

return output_dir + input_filename.substr(0, dot) + "_out.avi";
}

Expand Down

0 comments on commit 107d466

Please sign in to comment.