Skip to content

Commit

Permalink
DEVTOOLS: Fix parsing of codepage file path
Browse files Browse the repository at this point in the history
When the path does not contains a path separator (/ or \) the first
character of charset was skipped.
  • Loading branch information
criezy committed Mar 11, 2012
1 parent a5f4ff3 commit 334989f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion devtools/create_translations/cp_parser.cpp
Expand Up @@ -42,9 +42,11 @@ Codepage *parseCodepageMapping(const std::string &filename) {
size_t start = filename.find_last_of("/\\");
if (start == std::string::npos)
start = 0;
else
++start;
// Strip off the filename extension
const size_t pos = filename.find_last_of('.');
const std::string charset(filename.substr(start + 1, pos != std::string::npos ? (pos - start - 1) : std::string::npos));
const std::string charset(filename.substr(start, pos != std::string::npos ? (pos - start) : std::string::npos));

std::ifstream in(filename.c_str());
if (!in) {
Expand Down

0 comments on commit 334989f

Please sign in to comment.