FileDB.cpp 484 B

12345678910111213141516171819202122
  1. /*
  2. * Copyright (c) 2022, Itamar S. <itamar8910@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "FileDB.h"
  7. #include <AK/LexicalPath.h>
  8. namespace CodeComprehension {
  9. String FileDB::to_absolute_path(StringView filename) const
  10. {
  11. if (LexicalPath { filename }.is_absolute()) {
  12. return filename;
  13. }
  14. if (m_project_root.is_null())
  15. return filename;
  16. return LexicalPath { String::formatted("{}/{}", m_project_root, filename) }.string();
  17. }
  18. }