Skip to content

Commit 6f1cedb

Browse files
committed
use relative path for HTML report
#6
1 parent e5cebe4 commit 6f1cedb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/multihtmlreporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ MultiHtmlReporter::MultiHtmlReporter(string filename, vector<Mutation>& mutation
99
mMutationList = mutationList;
1010
mMutationMatches = mutationMatches;
1111
mFilename = filename;
12-
mFolderName = mFilename + ".files";
12+
mFolderName = basename(mFilename) + ".files";
1313
mkdir(mFolderName.c_str(), 0777);
1414
stat();
1515
}

src/util.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ inline bool file_exists(const string& s)
102102
return exists;
103103
}
104104

105+
inline string basename(const string& filename){
106+
string::size_type pos = filename.find_last_of('/');
107+
if (pos == string::npos)
108+
return filename;
109+
else if(pos == filename.length()-1)
110+
return ""; // a bad filename
111+
else
112+
return filename.substr(pos+1, filename.length() - pos - 1);
113+
}
105114

106115
// check if a string is a directory
107116
inline bool is_directory(const string& path)

0 commit comments

Comments
 (0)