mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-21 18:51:02 -04:00
refactor: Restructure project into sources/tests layout and dissolve PluginLLMCore
This commit is contained in:
51
sources/context/ProjectUtils.hpp
Normal file
51
sources/context/ProjectUtils.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2025-2026 Petr Mironychev
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace QodeAssist::Context {
|
||||
|
||||
/**
|
||||
* @brief Utility functions for working with Qt Creator projects
|
||||
*/
|
||||
class ProjectUtils
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Check if a file is part of any open project
|
||||
*
|
||||
* Checks if the given file path is either:
|
||||
* 1. Explicitly listed in project source files
|
||||
* 2. Located within a project directory
|
||||
*
|
||||
* @param filePath Absolute or canonical file path to check
|
||||
* @return true if file is part of any open project, false otherwise
|
||||
*/
|
||||
static bool isFileInProject(const QString &filePath);
|
||||
|
||||
/**
|
||||
* @brief Find a file in open projects by filename
|
||||
*
|
||||
* Searches all open projects for a file matching the given filename.
|
||||
* If multiple files with the same name exist, returns the first match.
|
||||
*
|
||||
* @param filename File name to search for (e.g., "main.cpp")
|
||||
* @return Absolute file path if found, empty string otherwise
|
||||
*/
|
||||
static QString findFileInProject(const QString &filename);
|
||||
|
||||
/**
|
||||
* @brief Get the project root directory
|
||||
*
|
||||
* Returns the root directory of the first open project.
|
||||
* If multiple projects are open, returns the first one.
|
||||
*
|
||||
* @return Absolute path to project root, or empty string if no project is open
|
||||
*/
|
||||
static QString getProjectRoot();
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::Context
|
||||
Reference in New Issue
Block a user