aboutsummaryrefslogtreecommitdiff
path: root/src/util/getuniquepath.cpp
blob: 105b4d52d28e366045e3640b23ede255370d64f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Copyright (c) 2021-2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <random.h>
#include <util/fs.h>
#include <util/strencodings.h>

fs::path GetUniquePath(const fs::path& base)
{
    FastRandomContext rnd;
    fs::path tmpFile = base / fs::u8path(HexStr(rnd.randbytes(8)));
    return tmpFile;
}