INNER CODE UNIT · Python

write_saved_endpoint

cvet/fonline · BuildTools/android_device.py:105

def write_saved_endpoint(workspace_root: Path, endpoint: str) -> None:
	state_file = state_file_path(workspace_root)
	state_file.parent.mkdir(parents=True, exist_ok=True)
	state_file.write_text(endpoint + '\n', encoding='utf-8')


def normalize_endpoint(value: str) -> str:
	endpoint = value.strip()
	if not endpoint:
		raise SystemExit('Android device endpoint is empty')
	if endpoint.count(':') == 0:
		return endpoint + ':5555'
	return endpoint


def split_endpoint(endpoint: str) -> tuple[str, int]:
	normalized_endpoint = normalize_endpoint(endpoint)
	host, separator, port_text = normalized_endpoint.rpartition(':')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…