Skip to content

Commit

Permalink
Allow multiple dots in filename (partially revers f67d862, resolves i…
Browse files Browse the repository at this point in the history
…ssue #21)
  • Loading branch information
squell committed Jun 3, 2021
1 parent c7b729d commit a899eac
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions setfname.cpp
Expand Up @@ -65,14 +65,8 @@ bool file::vmodify(const char* fname, const function& edit) const
}

string name = edited;
int dot = 1;
for(string::iterator p = name.end()-1; p != name.begin()-1; --p) {
for(string::iterator p = name.begin(); p != name.end(); ++p) {
if(!portable_fn(*p)) *p = '_'; // replace ill. chars
if(*p == '.') {
if(dot-- <= 0) {
*p = '_';
}
}
}
if(const char* psep = strrchr(fname, '/')) {
name.insert(0, fname, psep-fname+1); // copy path prefix
Expand Down

0 comments on commit a899eac

Please sign in to comment.