| 2320 | } |
| 2321 | |
| 2322 | static bool cbm_openclaw_config_path(const char *home_dir, char *out, size_t out_sz) { |
| 2323 | char internal_home[CLI_BUF_1K]; |
| 2324 | if (!cbm_openclaw_internal_home(home_dir, internal_home, sizeof(internal_home))) { |
| 2325 | return false; |
| 2326 | } |
| 2327 | char env_buf[CLI_BUF_1K]; |
| 2328 | const char *custom = cbm_safe_getenv("OPENCLAW_CONFIG_PATH", env_buf, sizeof(env_buf), NULL); |
| 2329 | if (custom && custom[0]) { |
| 2330 | return cbm_expand_user_path(internal_home, custom, out, out_sz); |
| 2331 | } |
| 2332 | char state_dir[CLI_BUF_1K]; |
| 2333 | if (!cbm_openclaw_state_dir(home_dir, state_dir, sizeof(state_dir))) { |
| 2334 | return false; |
| 2335 | } |
| 2336 | int written = snprintf(out, out_sz, "%s/openclaw.json", state_dir); |
| 2337 | return written > 0 && (size_t)written < out_sz; |
| 2338 | } |
| 2339 | |
| 2340 | static bool cbm_openclaw_workspace_path(const char *home_dir, const char *config_path, char *out, |
| 2341 | size_t out_sz) { |
no test coverage detected