mirror of
https://github.com/NixOS/nix
synced 2025-07-19 23:09:37 +02:00
getSourcePath(): Return std::filesystem::path
This commit is contained in:
parent
9003343b53
commit
f5548c17ed
7 changed files with 11 additions and 16 deletions
|
@ -358,7 +358,7 @@ void Input::clone(const Path & destDir) const
|
|||
scheme->clone(*this, destDir);
|
||||
}
|
||||
|
||||
std::optional<Path> Input::getSourcePath() const
|
||||
std::optional<std::filesystem::path> Input::getSourcePath() const
|
||||
{
|
||||
assert(scheme);
|
||||
return scheme->getSourcePath(*this);
|
||||
|
@ -461,7 +461,7 @@ Input InputScheme::applyOverrides(
|
|||
return input;
|
||||
}
|
||||
|
||||
std::optional<Path> InputScheme::getSourcePath(const Input & input) const
|
||||
std::optional<std::filesystem::path> InputScheme::getSourcePath(const Input & input) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
|
||||
void clone(const Path & destDir) const;
|
||||
|
||||
std::optional<Path> getSourcePath() const;
|
||||
std::optional<std::filesystem::path> getSourcePath() const;
|
||||
|
||||
/**
|
||||
* Write a file to this input, for input types that support
|
||||
|
@ -247,7 +247,7 @@ struct InputScheme
|
|||
|
||||
virtual void clone(const Input & input, const Path & destDir) const;
|
||||
|
||||
virtual std::optional<Path> getSourcePath(const Input & input) const;
|
||||
virtual std::optional<std::filesystem::path> getSourcePath(const Input & input) const;
|
||||
|
||||
virtual void putFile(
|
||||
const Input & input,
|
||||
|
|
|
@ -311,14 +311,9 @@ struct GitInputScheme : InputScheme
|
|||
runProgram("git", true, args, {}, true);
|
||||
}
|
||||
|
||||
// FIXME: return std::filesystem::path
|
||||
std::optional<Path> getSourcePath(const Input & input) const override
|
||||
std::optional<std::filesystem::path> getSourcePath(const Input & input) const override
|
||||
{
|
||||
auto repoInfo = getRepoInfo(input);
|
||||
if (auto path = repoInfo.getPath())
|
||||
return *path;
|
||||
else
|
||||
return std::nullopt;
|
||||
return getRepoInfo(input).getPath();
|
||||
}
|
||||
|
||||
void putFile(
|
||||
|
|
|
@ -126,7 +126,7 @@ struct MercurialInputScheme : InputScheme
|
|||
return res;
|
||||
}
|
||||
|
||||
std::optional<Path> getSourcePath(const Input & input) const override
|
||||
std::optional<std::filesystem::path> getSourcePath(const Input & input) const override
|
||||
{
|
||||
auto url = parseURL(getStrAttr(input.attrs, "url"));
|
||||
if (url.scheme == "file" && !input.getRef() && !input.getRev())
|
||||
|
|
|
@ -80,9 +80,9 @@ struct PathInputScheme : InputScheme
|
|||
};
|
||||
}
|
||||
|
||||
std::optional<Path> getSourcePath(const Input & input) const override
|
||||
std::optional<std::filesystem::path> getSourcePath(const Input & input) const override
|
||||
{
|
||||
return getStrAttr(input.attrs, "path");
|
||||
return getAbsPath(input);
|
||||
}
|
||||
|
||||
void putFile(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue