MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / _find_config_file

Method _find_config_file

unity_cli/config.py:93–114  ·  view source on GitHub ↗

Find config file in current directory or Unity project root. Returns: Path to config file if found, None otherwise.

(cls)

Source from the content-addressed store, hash-verified

91
92 @classmethod
93 def _find_config_file(cls) -> Path | None:
94 """Find config file in current directory or Unity project root.
95
96 Returns:
97 Path to config file if found, None otherwise.
98 """
99 cwd = Path.cwd()
100
101 # Check current directory first
102 config_in_cwd = cwd / CONFIG_FILE_NAME
103 if config_in_cwd.exists():
104 return config_in_cwd
105
106 # Search for Unity project root
107 for parent in [cwd, *list(cwd.parents)]:
108 if (parent / "Assets").is_dir() and (parent / "ProjectSettings").is_dir():
109 config_in_project = parent / CONFIG_FILE_NAME
110 if config_in_project.exists():
111 return config_in_project
112 break
113
114 return None
115
116 def to_toml(self) -> str:
117 """Generate TOML string from config.

Callers 2

loadMethod · 0.80
config_showFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected