1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

unitests: fix tmpdir when running with meson on macOS

This commit is contained in:
Jörg Thalheim 2024-09-17 19:13:29 +02:00
parent 98db531df2
commit a20659f4fa

View file

@ -3,6 +3,7 @@
#include "tests/nix_api_util.hh"
#include "file-system.hh"
#include <filesystem>
#include "nix_api_store.h"
#include "nix_api_store_internal.h"
@ -47,7 +48,9 @@ protected:
if (fs::create_directory(nixDir)) break;
}
#else
auto tmpl = nix::defaultTempDir() + "/tests_nix-store.XXXXXX";
// resolve any symlinks in i.e. on macOS /tmp -> /private/tmp
// because this is not allowed for a nix store.
auto tmpl = nix::absPath(std::filesystem::path(nix::defaultTempDir()) / "tests_nix-store.XXXXXX", true);
nixDir = mkdtemp((char *) tmpl.c_str());
#endif