2022-05-14 17:09:24 +03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, Itamar S. <itamar8910@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "FileDB.h"
|
|
|
|
|
#include <AK/LexicalPath.h>
|
|
|
|
|
|
|
|
|
|
namespace CodeComprehension {
|
|
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
ByteString FileDB::to_absolute_path(StringView filename) const
|
2022-05-14 17:09:24 +03:00
|
|
|
{
|
|
|
|
|
if (LexicalPath { filename }.is_absolute()) {
|
|
|
|
|
return filename;
|
|
|
|
|
}
|
2023-10-10 15:00:58 +03:30
|
|
|
if (!m_project_root.has_value())
|
2022-05-14 17:09:24 +03:00
|
|
|
return filename;
|
2023-12-16 17:49:34 +03:30
|
|
|
return LexicalPath { ByteString::formatted("{}/{}", *m_project_root, filename) }.string();
|
2022-05-14 17:09:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|