1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

fix output filename

This commit is contained in:
Lu Wang 2012-09-13 11:38:56 +08:00
parent 4610266188
commit 79601b6605
3 changed files with 16 additions and 5 deletions

View File

@ -58,7 +58,7 @@ void ArgParser::parse(int argc, char ** argv) const
{
//prepare optstring and longopts
vector<char> optstring;
optstring.reserve(arg_entries.size() + 1);
optstring.reserve(2*arg_entries.size() + 1);
vector<struct option> longopts;
longopts.reserve(arg_entries.size() + 1);

View File

@ -183,14 +183,19 @@ int main(int argc, char **argv)
if(get_suffix(param.input_filename) == ".pdf")
{
param.output_filename = s.substr(0, s.size() - 4);
if(!param.split_pages)
if(param.split_pages)
param.output_filename = s.substr(0, s.size() - 4);
else
param.output_filename = s.substr(0, s.size() - 4) + ".html";
}
else
{
if(!param.split_pages)
if(param.split_pages)
param.output_filename = s;
else
param.output_filename = s + ".html";
}
}
if(param.css_filename == "")

View File

@ -7,6 +7,7 @@
*/
#include <errno.h>
#include <cctype>
#include <GfxState.h>
#include <GfxFont.h>
@ -201,7 +202,12 @@ string get_suffix(const string & path)
if(idx == string::npos)
return "";
else
return fn.substr(idx);
{
string s = fn.substr(idx);
for(auto iter = s.begin(); iter != s.end(); ++iter)
*iter = tolower(*iter);
return s;
}
}
} // namespace pdf2htmlEX