File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,16 +100,34 @@ function clawArgs(args) {
100100 return [ OPENCLAW_ENTRY , ...args ] ;
101101}
102102
103+ function resolveConfigCandidates ( ) {
104+ const explicit = getEnvWithShim ( "OPENCLAW_CONFIG_PATH" , "CLAWDBOT_CONFIG_PATH" ) ;
105+ if ( explicit ) return [ explicit ] ;
106+
107+ // Prefer the newest canonical name, but fall back to legacy filenames if present.
108+ return [
109+ path . join ( STATE_DIR , "openclaw.json" ) ,
110+ path . join ( STATE_DIR , "moltbot.json" ) ,
111+ path . join ( STATE_DIR , "clawdbot.json" ) ,
112+ ] ;
113+ }
114+
103115function configPath ( ) {
104- return (
105- getEnvWithShim ( "OPENCLAW_CONFIG_PATH" , "CLAWDBOT_CONFIG_PATH" ) ||
106- path . join ( STATE_DIR , "openclaw.json" )
107- ) ;
116+ const candidates = resolveConfigCandidates ( ) ;
117+ for ( const candidate of candidates ) {
118+ try {
119+ if ( fs . existsSync ( candidate ) ) return candidate ;
120+ } catch {
121+ // ignore
122+ }
123+ }
124+ // Default to canonical even if it doesn't exist yet.
125+ return candidates [ 0 ] || path . join ( STATE_DIR , "openclaw.json" ) ;
108126}
109127
110128function isConfigured ( ) {
111129 try {
112- return fs . existsSync ( configPath ( ) ) ;
130+ return resolveConfigCandidates ( ) . some ( ( candidate ) => fs . existsSync ( candidate ) ) ;
113131 } catch {
114132 return false ;
115133 }
You can’t perform that action at this time.
0 commit comments