Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions codeflash/cli_cmds/init_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
from codeflash.code_utils.shell_utils import get_shell_rc_path, is_powershell
from codeflash.telemetry.posthog_cf import ph

_cached_theme = None


class JavaBuildTool(Enum):
"""Java build tools."""
Expand Down Expand Up @@ -57,9 +59,11 @@ class JavaSetupInfo:

def _get_theme():
"""Get the CodeflashTheme - imported lazily to avoid circular imports."""
from codeflash.cli_cmds.cmd_init import CodeflashTheme

return CodeflashTheme()
global _cached_theme
if _cached_theme is None:
from codeflash.cli_cmds.cmd_init import CodeflashTheme
_cached_theme = CodeflashTheme()
return _cached_theme


def detect_java_build_tool(project_root: Path) -> JavaBuildTool:
Expand Down
3 changes: 2 additions & 1 deletion codeflash/code_utils/code_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ def validate_relative_directory_path(path: str) -> tuple[bool, str]:

# Check for absolute paths, invalid characters, and validate path format
error_msg = ""
if Path(path).is_absolute():
# Use os.path.isabs() which is faster than Path().is_absolute()
if os.path.isabs(path):
error_msg = "Path must be relative, not absolute"
elif os.name == "nt": # Windows
if any(char in _INVALID_CHARS_NT for char in path):
Expand Down
Loading