summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_io_qtemporarydir.cpp
blob: 037cf8a36d00a8477c3f050ed3825e981138624b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

{
//! [0]
    // Within a function/method...

    QTemporaryDir dir;
    if (dir.isValid()) {
        // dir.path() returns the unique directory path
    }

    // The QTemporaryDir destructor removes the temporary directory
    // as it goes out of scope.
//! [0]
}