diff options
Diffstat (limited to 'third_party/nix/src/nix')
-rw-r--r-- | third_party/nix/src/nix/doctor.cc | 4 | ||||
-rw-r--r-- | third_party/nix/src/nix/repl.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/nix/upgrade-nix.cc | 6 |
3 files changed, 9 insertions, 4 deletions
diff --git a/third_party/nix/src/nix/doctor.cc b/third_party/nix/src/nix/doctor.cc index 44b4bd605d6c..79e9eb5394e7 100644 --- a/third_party/nix/src/nix/doctor.cc +++ b/third_party/nix/src/nix/doctor.cc @@ -1,3 +1,5 @@ +#include <absl/strings/match.h> + #include "command.hh" #include "serve-protocol.hh" #include "shared.hh" @@ -73,7 +75,7 @@ struct CmdDoctor : StoreCommand { Path userEnv = canonPath(profileDir, true); if (store->isStorePath(userEnv) && - hasSuffix(userEnv, "user-environment")) { + absl::EndsWith(userEnv, "user-environment")) { while (profileDir.find("/profiles/") == std::string::npos && isLink(profileDir)) { profileDir = absPath(readLink(profileDir), dirOf(profileDir)); diff --git a/third_party/nix/src/nix/repl.cc b/third_party/nix/src/nix/repl.cc index e2e4de6fec1b..f6261cfeccc7 100644 --- a/third_party/nix/src/nix/repl.cc +++ b/third_party/nix/src/nix/repl.cc @@ -6,6 +6,7 @@ #include <utility> #include <absl/strings/ascii.h> +#include <absl/strings/match.h> #include <glog/logging.h> #ifdef READLINE @@ -356,7 +357,7 @@ StringSet NixRepl::completePrefix(const std::string& prefix) { auto dir = std::string(cur, 0, slash); auto prefix2 = std::string(cur, slash + 1); for (auto& entry : readDirectory(dir.empty() ? "/" : dir)) { - if (entry.name[0] != '.' && hasPrefix(entry.name, prefix2)) { + if (entry.name[0] != '.' && absl::StartsWith(entry.name, prefix2)) { completions.insert(prev + dir + "/" + entry.name); } } diff --git a/third_party/nix/src/nix/upgrade-nix.cc b/third_party/nix/src/nix/upgrade-nix.cc index 08c411f4b4c5..7098e0eb904d 100644 --- a/third_party/nix/src/nix/upgrade-nix.cc +++ b/third_party/nix/src/nix/upgrade-nix.cc @@ -1,3 +1,4 @@ +#include <absl/strings/match.h> #include <glog/logging.h> #include "attr-path.hh" @@ -114,7 +115,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand { LOG(INFO) << "found Nix in '" << where << "'"; - if (hasPrefix(where, "/run/current-system")) { + if (absl::StartsWith(where, "/run/current-system")) { throw Error("Nix on NixOS must be upgraded via 'nixos-rebuild'"); } @@ -130,7 +131,8 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand { Path userEnv = canonPath(profileDir, true); - if (baseNameOf(where) != "bin" || !hasSuffix(userEnv, "user-environment")) { + if (baseNameOf(where) != "bin" || + !absl::EndsWith(userEnv, "user-environment")) { throw Error("directory '%s' does not appear to be part of a Nix profile", where); } |