win: asar: Support "\" as path separator

This commit is contained in:
Cheng Zhao 2014-09-30 20:12:18 +08:00
Родитель 927ec6ab7a
Коммит 301014e4a6
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -18,6 +18,12 @@ namespace asar {
namespace {
#if defined(OS_WIN)
const char kSeparators[] = "\\/";
#else
const char kSeparators[] = "/";
#endif
bool GetNodeFromPath(std::string path,
const base::DictionaryValue* root,
const base::DictionaryValue** out);
@ -58,9 +64,9 @@ bool GetNodeFromPath(std::string path,
}
const base::DictionaryValue* dir = root;
for (size_t delimiter_position = path.find('/');
for (size_t delimiter_position = path.find_first_of(kSeparators);
delimiter_position != std::string::npos;
delimiter_position = path.find('/')) {
delimiter_position = path.find_first_of(kSeparators)) {
const base::DictionaryValue* child = NULL;
if (!GetChildNode(root, path.substr(0, delimiter_position), dir, &child))
return false;