From 95da93c05b7e0f436a3a467810380b0dd85c6131 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Oct 2025 13:38:53 +0200 Subject: [PATCH] Input::clone(): Use std::filesystem::path --- src/libfetchers/fetchers.cc | 4 ++-- src/libfetchers/git.cc | 2 +- src/libfetchers/github.cc | 6 +++--- src/libfetchers/include/nix/fetchers/fetchers.hh | 4 ++-- src/nix/flake.cc | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc index 1b1b39a9c..ab7b50ea7 100644 --- a/src/libfetchers/fetchers.cc +++ b/src/libfetchers/fetchers.cc @@ -377,7 +377,7 @@ Input Input::applyOverrides(std::optional ref, std::optional return scheme->applyOverrides(*this, ref, rev); } -void Input::clone(const Settings & settings, const Path & destDir) const +void Input::clone(const Settings & settings, const std::filesystem::path & destDir) const { assert(scheme); scheme->clone(settings, *this, destDir); @@ -493,7 +493,7 @@ void InputScheme::putFile( throw Error("input '%s' does not support modifying file '%s'", input.to_string(), path); } -void InputScheme::clone(const Settings & settings, const Input & input, const Path & destDir) const +void InputScheme::clone(const Settings & settings, const Input & input, const std::filesystem::path & destDir) const { throw Error("do not know how to clone input '%s'", input.to_string()); } diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc index d162d1656..b10d6d0bb 100644 --- a/src/libfetchers/git.cc +++ b/src/libfetchers/git.cc @@ -278,7 +278,7 @@ struct GitInputScheme : InputScheme return res; } - void clone(const Settings & settings, const Input & input, const Path & destDir) const override + void clone(const Settings & settings, const Input & input, const std::filesystem::path & destDir) const override { auto repoInfo = getRepoInfo(input); diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index bdc196386..af633dda1 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -426,7 +426,7 @@ struct GitHubInputScheme : GitArchiveInputScheme return DownloadUrl{parseURL(url), headers}; } - void clone(const Settings & settings, const Input & input, const Path & destDir) const override + void clone(const Settings & settings, const Input & input, const std::filesystem::path & destDir) const override { auto host = getHost(input); Input::fromURL(settings, fmt("git+https://%s/%s/%s.git", host, getOwner(input), getRepo(input))) @@ -507,7 +507,7 @@ struct GitLabInputScheme : GitArchiveInputScheme return DownloadUrl{parseURL(url), headers}; } - void clone(const Settings & settings, const Input & input, const Path & destDir) const override + void clone(const Settings & settings, const Input & input, const std::filesystem::path & destDir) const override { auto host = maybeGetStrAttr(input.attrs, "host").value_or("gitlab.com"); // FIXME: get username somewhere @@ -596,7 +596,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme return DownloadUrl{parseURL(url), headers}; } - void clone(const Settings & settings, const Input & input, const Path & destDir) const override + void clone(const Settings & settings, const Input & input, const std::filesystem::path & destDir) const override { auto host = maybeGetStrAttr(input.attrs, "host").value_or("git.sr.ht"); Input::fromURL( diff --git a/src/libfetchers/include/nix/fetchers/fetchers.hh b/src/libfetchers/include/nix/fetchers/fetchers.hh index 66915ae0d..978fd2276 100644 --- a/src/libfetchers/include/nix/fetchers/fetchers.hh +++ b/src/libfetchers/include/nix/fetchers/fetchers.hh @@ -143,7 +143,7 @@ public: Input applyOverrides(std::optional ref, std::optional rev) const; - void clone(const Settings & settings, const Path & destDir) const; + void clone(const Settings & settings, const std::filesystem::path & destDir) const; std::optional getSourcePath() const; @@ -216,7 +216,7 @@ struct InputScheme virtual Input applyOverrides(const Input & input, std::optional ref, std::optional rev) const; - virtual void clone(const Settings & settings, const Input & input, const Path & destDir) const; + virtual void clone(const Settings & settings, const Input & input, const std::filesystem::path & destDir) const; virtual std::optional getSourcePath(const Input & input) const; diff --git a/src/nix/flake.cc b/src/nix/flake.cc index b4d8b29bf..80cad095f 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -1019,7 +1019,7 @@ struct CmdFlakeNew : CmdFlakeInitCommon struct CmdFlakeClone : FlakeCommand { - Path destDir; + std::filesystem::path destDir; std::string description() override {