mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-31 15:36:47 +02:00
Use std::filesystem::path
in more executables
This commit is contained in:
parent
8e70f6f850
commit
d98e06a581
2 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,7 @@ using namespace nix;
|
|||
typedef std::map<std::string, std::string> Channels;
|
||||
|
||||
static Channels channels;
|
||||
static Path channelsList;
|
||||
static std::filesystem::path channelsList;
|
||||
|
||||
// Reads the list of channels.
|
||||
static void readChannels()
|
||||
|
@ -41,7 +41,7 @@ static void writeChannels()
|
|||
{
|
||||
auto channelsFD = AutoCloseFD{open(channelsList.c_str(), O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC, 0644)};
|
||||
if (!channelsFD)
|
||||
throw SysError("opening '%1%' for writing", channelsList);
|
||||
throw SysError("opening '%1%' for writing", channelsList.string());
|
||||
for (const auto & channel : channels)
|
||||
writeFull(channelsFD.get(), channel.second + " " + channel.first + "\n");
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ static int main_nix_channel(int argc, char ** argv)
|
|||
{
|
||||
// Figure out the name of the `.nix-channels' file to use
|
||||
auto home = getHome();
|
||||
channelsList = settings.useXDGBaseDirectories ? createNixStateDir() + "/channels" : home + "/.nix-channels";
|
||||
channelsList = settings.useXDGBaseDirectories ? createNixStateDir() + OS_STR("/channels") : home + OS_STR("/.nix-channels");
|
||||
nixDefExpr = getNixDefExpr();
|
||||
|
||||
// Figure out the name of the channels profile.
|
||||
|
|
|
@ -21,7 +21,7 @@ bool dryRun = false;
|
|||
* Of course, this makes rollbacks to before this point in time
|
||||
* impossible. */
|
||||
|
||||
void removeOldGenerations(std::string dir)
|
||||
void removeOldGenerations(std::filesystem::path dir)
|
||||
{
|
||||
if (access(dir.c_str(), R_OK) != 0) return;
|
||||
|
||||
|
@ -81,7 +81,7 @@ static int main_nix_collect_garbage(int argc, char * * argv)
|
|||
});
|
||||
|
||||
if (removeOld) {
|
||||
std::set<Path> dirsToClean = {
|
||||
std::set<std::filesystem::path> dirsToClean = {
|
||||
profilesDir(), settings.nixStateDir + "/profiles", dirOf(getDefaultProfile())};
|
||||
for (auto & dir : dirsToClean)
|
||||
removeOldGenerations(dir);
|
||||
|
|
Loading…
Reference in a new issue