Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_app_runtime_paths.h File Reference

Declares helpers for locating app roots and deriving runtime paths. More...

Go to the source code of this file.

Functions

App runtime path helpers
char * match_app_root_in_directory (const char *base_dir, const char *target_id)
 Searches one directory for an app root matching a target identifier.
char * find_app_root_for_target (const char *target_id, const char *app_dir_hint, const char *repo_root, const char *binary_dir)
 Locates an app root for a target using explicit app-dir hints and canonical apps directories.
char * app_build_dir_local_native (const char *app_root)
 Builds the default local build directory path for an app.
char * effective_app_build_dir_native (const char *app_root, const char *build_dir_override)
 Resolves the effective build directory for an app.
char * app_artifact_dir_from_build_dir_native (const char *build_dir, const char *app_id)
 Resolves the artifact directory for one app from a build root or deployed app parent.
char * effective_app_artifact_dir_native (const char *app_root, const char *build_dir, const char *app_id)
 Resolves the effective artifact directory for an app from framework build root plus app-owned contract hints.
char * app_state_path_local_native (const char *app_root, const char *build_dir, const char *app_id)
 Builds the default local state file path for an app.
char * effective_app_state_path_native (const char *app_root, const char *build_dir, const char *app_id, const char *state_path_override, const char *state_dir_override)
 Resolves the effective state file path for an app.
char * app_base_path_local_native (const char *app_root)
 Builds the default local URL base path for an app.
char * effective_app_base_path_native (const char *app_root, const char *base_path_override)
 Resolves the effective URL base path for an app.
char * app_log_path_local_native (const char *app_root, const char *app_id)
 Builds the default local log file path for an app.
char * effective_app_log_path_native (const char *app_root, const char *app_id, const char *log_path_override)
 Resolves the effective log file path for an app.
char * app_log_format_local_native (const char *app_root)
 Builds the default local log format setting for an app.
char * effective_app_log_format_native (const char *app_root)
 Resolves the effective log format for an app.
char * app_error_report_path_local_native (const char *app_root)
 Builds the default local error report path for an app.
char * effective_app_error_report_path_native (const char *app_root, const char *app_id)
 Resolves the effective error report path for an app.
char * app_debug_local_native (const char *app_root)
 Builds the default local debug setting for an app.
char * effective_app_debug_native (const char *app_root, const char *debug_override)
 Resolves the effective debug setting for an app.

Detailed Description

Declares helpers for locating app roots and deriving runtime paths.

Definition in file native_app_runtime_paths.h.

Function Documentation

◆ app_artifact_dir_from_build_dir_native()

char * app_artifact_dir_from_build_dir_native ( const char * build_dir,
const char * app_id )

Resolves the artifact directory for one app from a build root or deployed app parent.

Parameters
build_dirBuild root or deployed app parent directory.
app_idApp identifier.
Returns
Newly allocated artifact directory path, or NULL on failure.

Definition at line 178 of file native_app_runtime_paths.c.

References len, path_join(), and streq().

Referenced by effective_app_artifact_dir_native().

◆ app_base_path_local_native()

char * app_base_path_local_native ( const char * app_root)

Builds the default local URL base path for an app.

Parameters
app_rootRoot directory of the app.
Returns
Newly allocated base path string, or NULL on failure.

Definition at line 300 of file native_app_runtime_paths.c.

References AppLocalConfigNative::base_path, free_app_local_config_native(), load_app_local_config_native(), AppLocalConfigNative::manifest_base_path, normalize_base_path_native(), and pharos_app_runtime_paths_strdup.

Referenced by effective_app_base_path_native().

◆ app_build_dir_local_native()

char * app_build_dir_local_native ( const char * app_root)

Builds the default local build directory path for an app.

Parameters
app_rootRoot directory of the app.
Returns
Newly allocated build directory path, or NULL on failure.

Definition at line 139 of file native_app_runtime_paths.c.

References AppLocalConfigNative::build_dir, free_app_local_config_native(), load_app_local_config_native(), AppLocalConfigNative::manifest_build_artifact_dir, path_dirname(), path_join(), pharos_app_runtime_paths_strdup, and streq().

Referenced by effective_app_build_dir_native(), and runtime_build_dir_override_native().

◆ app_debug_local_native()

char * app_debug_local_native ( const char * app_root)

Builds the default local debug setting for an app.

Parameters
app_rootRoot directory of the app.
Returns
Newly allocated debug setting string, or NULL on failure.

Definition at line 398 of file native_app_runtime_paths.c.

References AppLocalConfigNative::debug, free_app_local_config_native(), load_app_local_config_native(), and pharos_app_runtime_paths_strdup.

Referenced by effective_app_debug_native().

◆ app_error_report_path_local_native()

char * app_error_report_path_local_native ( const char * app_root)

Builds the default local error report path for an app.

Parameters
app_rootRoot directory of the app.
Returns
Newly allocated error report path, or NULL on failure.

Definition at line 366 of file native_app_runtime_paths.c.

References AppLocalConfigNative::error_report_path, free_app_local_config_native(), load_app_local_config_native(), and pharos_app_runtime_paths_strdup.

Referenced by effective_app_error_report_path_native().

◆ app_log_format_local_native()

char * app_log_format_local_native ( const char * app_root)

Builds the default local log format setting for an app.

Parameters
app_rootRoot directory of the app.
Returns
Newly allocated log format string, or NULL on failure.

Definition at line 357 of file native_app_runtime_paths.c.

References pharos_app_runtime_paths_strdup.

Referenced by effective_app_log_format_native().

◆ app_log_path_local_native()

char * app_log_path_local_native ( const char * app_root,
const char * app_id )

Builds the default local log file path for an app.

Parameters
app_rootRoot directory of the app.
app_idApp identifier.
Returns
Newly allocated log path, or NULL on failure.

Definition at line 327 of file native_app_runtime_paths.c.

References free_app_local_config_native(), load_app_local_config_native(), AppLocalConfigNative::log_path, and pharos_app_runtime_paths_strdup.

Referenced by effective_app_log_path_native().

◆ app_state_path_local_native()

char * app_state_path_local_native ( const char * app_root,
const char * build_dir,
const char * app_id )

Builds the default local state file path for an app.

Parameters
app_rootRoot directory of the app.
build_dirEffective build directory for the app.
app_idApp identifier.
Returns
Newly allocated state file path, or NULL on failure.

Definition at line 233 of file native_app_runtime_paths.c.

References effective_app_artifact_dir_native(), free_app_local_config_native(), load_app_local_config_native(), AppLocalConfigNative::manifest_state_path, path_join(), pharos_app_runtime_paths_strdup, AppLocalConfigNative::state_dir, AppLocalConfigNative::state_path, and streq().

Referenced by effective_app_state_path_native().

◆ effective_app_artifact_dir_native()

char * effective_app_artifact_dir_native ( const char * app_root,
const char * build_dir,
const char * app_id )

Resolves the effective artifact directory for an app from framework build root plus app-owned contract hints.

Parameters
app_rootRoot directory of the app.
build_dirEffective build directory selected by Pharos.
app_idApp identifier.
Returns
Newly allocated artifact directory path, or NULL on failure.

Definition at line 202 of file native_app_runtime_paths.c.

References app_artifact_dir_from_build_dir_native(), free_app_local_config_native(), load_app_local_config_native(), AppLocalConfigNative::manifest_build_artifact_dir, path_join(), pharos_app_runtime_paths_strdup, and streq().

Referenced by add_runtime_app_native(), app_state_path_local_native(), and build_app_from_root_native().

◆ effective_app_base_path_native()

char * effective_app_base_path_native ( const char * app_root,
const char * base_path_override )

Resolves the effective URL base path for an app.

Parameters
app_rootRoot directory of the app.
base_path_overrideOptional explicit base path override.
Returns
Newly allocated effective base path, or NULL on failure.

Definition at line 320 of file native_app_runtime_paths.c.

References app_base_path_local_native(), and normalize_base_path_native().

Referenced by build_app_from_root_native(), finalize_base_path_native(), and maybe_seed_app_state_native().

◆ effective_app_build_dir_native()

char * effective_app_build_dir_native ( const char * app_root,
const char * build_dir_override )

Resolves the effective build directory for an app.

Parameters
app_rootRoot directory of the app.
build_dir_overrideOptional explicit build directory override.
Returns
Newly allocated effective build directory path, or NULL on failure.

Definition at line 171 of file native_app_runtime_paths.c.

References app_build_dir_local_native(), and pharos_app_runtime_paths_strdup.

Referenced by build_app_from_root_native(), load_app_runtime_for_single_app(), prepare_app_artifact_native(), and prepare_finalized_app_from_config().

◆ effective_app_debug_native()

char * effective_app_debug_native ( const char * app_root,
const char * debug_override )

Resolves the effective debug setting for an app.

Parameters
app_rootRoot directory of the app.
debug_overrideOptional explicit debug override.
Returns
Newly allocated effective debug setting string, or NULL on failure.

Definition at line 414 of file native_app_runtime_paths.c.

References app_debug_local_native(), and pharos_app_runtime_paths_strdup.

Referenced by build_app_from_root_native(), and finalize_debug_native().

◆ effective_app_error_report_path_native()

char * effective_app_error_report_path_native ( const char * app_root,
const char * app_id )

Resolves the effective error report path for an app.

Parameters
app_rootRoot directory of the app.
app_idApp identifier.
Returns
Newly allocated effective error report path, or NULL on failure.

Definition at line 382 of file native_app_runtime_paths.c.

References app_error_report_path_local_native().

Referenced by build_app_from_root_native(), and finalize_error_report_path_native().

◆ effective_app_log_format_native()

char * effective_app_log_format_native ( const char * app_root)

Resolves the effective log format for an app.

Parameters
app_rootRoot directory of the app.
Returns
Newly allocated effective log format string, or NULL on failure.

Definition at line 362 of file native_app_runtime_paths.c.

References app_log_format_local_native().

Referenced by build_app_from_root_native(), and finalize_log_format_native().

◆ effective_app_log_path_native()

char * effective_app_log_path_native ( const char * app_root,
const char * app_id,
const char * log_path_override )

Resolves the effective log file path for an app.

Parameters
app_rootRoot directory of the app.
app_idApp identifier.
log_path_overrideOptional explicit log path override.
Returns
Newly allocated effective log path, or NULL on failure.

Definition at line 350 of file native_app_runtime_paths.c.

References app_log_path_local_native(), and pharos_app_runtime_paths_strdup.

Referenced by build_app_from_root_native(), and finalize_log_path_native().

◆ effective_app_state_path_native()

char * effective_app_state_path_native ( const char * app_root,
const char * build_dir,
const char * app_id,
const char * state_path_override,
const char * state_dir_override )

Resolves the effective state file path for an app.

Parameters
app_rootRoot directory of the app.
build_dirEffective build directory for the app.
app_idApp identifier.
state_path_overrideOptional explicit state file override.
state_dir_overrideOptional explicit state directory override.
Returns
Newly allocated effective state file path, or NULL on failure.

Definition at line 281 of file native_app_runtime_paths.c.

References app_state_path_local_native(), path_join(), and pharos_app_runtime_paths_strdup.

Referenced by build_app_from_root_native(), finalize_state_path_native(), and maybe_seed_app_state_native().

◆ find_app_root_for_target()

char * find_app_root_for_target ( const char * target_id,
const char * app_dir_hint,
const char * repo_root,
const char * binary_dir )

Locates an app root for a target using explicit app-dir hints and canonical apps directories.

Parameters
target_idApp identifier to locate.
app_dir_hintOptional app directory or apps directory hint.
repo_rootRepository root whose apps directory may be consulted.
binary_dirExecutable directory for nearby apps-directory fallback discovery.
Returns
Newly allocated app root path, or NULL when the app cannot be found.

Definition at line 100 of file native_app_runtime_paths.c.

References match_app_root_in_directory(), path_dirname(), and path_join().

Referenced by handle_native_runtime_app_command(), load_app_runtime_for_single_app(), and prepare_finalized_app_from_config().

◆ match_app_root_in_directory()

char * match_app_root_in_directory ( const char * base_dir,
const char * target_id )

Searches one directory for an app root matching a target identifier.

Parameters
base_dirDirectory whose child entries should be inspected.
target_idApp identifier to match.
Returns
Newly allocated app root path, or NULL when no match is found.

Definition at line 23 of file native_app_runtime_paths.c.

References json_find_string(), path_canonicalize(), path_exists(), path_is_directory(), path_join(), pharos_app_runtime_paths_strdup, read_file_text(), and streq().

Referenced by find_app_root_for_target().