Skip to content

Commit

Permalink
add case if .benchmark does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Oviedo <[email protected]>
  • Loading branch information
OVI3D0 committed Jan 3, 2025
1 parent 10914e7 commit bb2df83
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions osbenchmark/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,22 @@ def benchmark_confdir():
default_home = os.path.expanduser("~")
old_path = os.path.join(default_home, ".benchmark")
new_path = os.path.join(default_home, ".osb")
if os.path.exists(old_path) and not os.path.exists(new_path):
os.symlink(old_path, new_path)

# Create .benchmark directory if it doesn't exist
if not os.path.exists(old_path):
os.makedirs(old_path, exist_ok=True)

# Create .osb directory if it doesn't exist
if not os.path.exists(new_path):
os.makedirs(new_path, exist_ok=True)

# Create symlink from .osb to .benchmark if it doesn't exist
if not os.path.islink(new_path):
try:
os.symlink(old_path, new_path, target_is_directory=True)
except OSError:
print(f"Warning: Failed to create symlink from {new_path} to {old_path}")

return os.path.join(os.getenv("BENCHMARK_HOME", default_home), ".osb")


Expand Down

0 comments on commit bb2df83

Please sign in to comment.