1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#pragma once
5
6#include "qdoc/boundaries/refined_typedef.h"
7
8#include <optional>
9
10#include <QtCore/qstring.h>
11#include <QtCore/qfileinfo.h>
12
13QDOC_REFINED_TYPEDEF(QString, FilePath) {
14 QFileInfo info{value};
15
16 return (info.isFile() && info.isReadable()) ? std::optional(FilePath{info.canonicalFilePath()}) : std::nullopt;
17}
18

source code of qttools/src/qdoc/qdoc/src/qdoc/boundaries/filesystem/filepath.h