Resource.hpp

1. Overview

Header-only resource locator that resolves images, CSS, and other application data from an environment override, the compiled system data directory, or the current user’s XDG data directory.

File role: Header Interface. The file contains 52 lines and belongs to the Resource.hpp path.


2. Component Responsibilities

  • Declare the component API, owned state, callbacks, and data structures.
  • Check the BSC_DATA override
  • Check the compiled DATA_DIR installation path
  • Check XDG_DATA_HOME or ~/.local/share
  • Return the system fallback path and log a warning when the file is not found

3. Dependencies and Integration

System and library dependencies:

  • string
  • filesystem
  • iostream
  • cstdlib

4. Owned State and UI Members

Data and configuration state

  • std::string userBase;
  • std::string user_path = userBase + "/bastionguard-sc/data/" + rel;

5. Functions and Methods

The file exposes or implements 1 detected function or method signatures.

1. resource

inline std::string resource(const std::string& rel)

Implements the resource operation declared by this component.


6. Filesystem, IPC, Network, and Command Interfaces

Relevant literal paths, endpoints, or resource locations include:

  • /usr/share/bastionguard-sc/data
  • /.local/share
  • /bastionguard-sc/data/

7. Runtime Flow

  1. Check the BSC_DATA override
  2. Check the compiled DATA_DIR installation path
  3. Check XDG_DATA_HOME or ~/.local/share
  4. Return the system fallback path and log a warning when the file is not found

8. Runtime and Security Considerations

  • Only returns paths that exist during the preferred lookup stages.
  • Allows controlled development overrides through BSC_DATA.

9. Error Handling and Operational Notes

  • Diagnostic failures are written to standard error or the GLib logging channel.

10. Source Integrity

Relative source path: Resource.hpp

SHA-256:

f1abe1d601f9123ed3ff5c42ce905b416f8108d9bc77502ca31ccf985a569262

11. Licensing

The source header identifies this component as distributed under the GNU General Public License version 3. BastionGuard branding and trademarks remain subject to the notices stated in the source file.