namespace nix {
-
-bool useCaseHack =
-#if __APPLE__
- true;
-#else
- false;
-#endif
-
static string archiveVersion1 = "nix-archive-1";
static string caseHackSuffix = "~nix~case~hack~";
the case hack applied by restorePath(). */
std::map<string, string> unhacked;
for (auto & i : readDirectory(path))
- if (useCaseHack) {
- string name(i.name);
- size_t pos = i.name.find(caseHackSuffix);
- if (pos != string::npos) {
- printMsg(lvlDebug, format("removing case hack suffix from `%1%'") % (path + "/" + i.name));
- name.erase(pos);
- }
- if (unhacked.find(name) != unhacked.end())
- throw Error(format("file name collision in between `%1%' and `%2%'")
- % (path + "/" + unhacked[name]) % (path + "/" + i.name));
- unhacked[name] = i.name;
- } else
- unhacked[i.name] = i.name;
+ unhacked[i.name] = i.name;
for (auto & i : unhacked)
if (filter(path + "/" + i.first)) {
if (name <= prevName)
throw Error("NAR directory is not sorted");
prevName = name;
- if (useCaseHack) {
- auto i = names.find(name);
- if (i != names.end()) {
- printMsg(lvlDebug, format("case collision between `%1%' and `%2%'") % i->first % name);
- name += caseHackSuffix;
- name += int2String(++i->second);
- } else
- names[name] = 0;
- }
} else if (s == "node") {
if (s.empty()) throw badArchive("entry name missing");
parse(sink, source, path + "/" + name);
decoded. Ignore and throw the exception below. */
}
if (version != archiveVersion1)
- throw badArchive("input doesn't look like a Nix archive");
+ throw badArchive("input doesn't look like a normalized archive");
parse(sink, source, "");
}