- if (temp[j][0] == '.' && temp[j][1] == '/')
- tempFilename = temp[j].substr(2, temp[j].size()-1);
+#ifdef _WIN32
+ // There is a bug on Windows, the last \ is a /...
+ // Let's substitute it
+ const size_t last_slash_idx_win = tempFilename.rfind('/');
+ tempFilename[last_slash_idx_win] = '\\';
+ const size_t first_slash_idx = tempFilename.find('\\');
+#else
+ const size_t first_slash_idx = tempFilename.find('/');
+#endif
+ if (std::string::npos != first_slash_idx && first_slash_idx == 1 && tempFilename[0] == '.')
+ tempFilename = tempFilename.substr(first_slash_idx+1);