summaryrefslogtreecommitdiffstats
path: root/src/qdoc/qdoc/src/qdoc/boundaries/filesystem/directorypath.h
blob: 7ec1dd415cafab897728705c5ba4b039fcb84b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "../refined_typedef.h"

#include <optional>

#include <QtCore/qstring.h>
#include <QtCore/qfileinfo.h>

QDOC_REFINED_TYPEDEF(QString, DirectoryPath) {
    QFileInfo info{value};

    return (info.isDir() && info.isReadable() && info.isExecutable()) ? std::optional(DirectoryPath{info.canonicalFilePath()}) : std::nullopt;
}