Skip to content

Commit

Permalink
Merge pull request #730 from serokell/krendelhoff/#728-home-not-expand
Browse files Browse the repository at this point in the history
[#728] Expand tilde char in user provided path
  • Loading branch information
krendelhoff2 authored Oct 3, 2023
2 parents f9fa44b + 6d8784f commit 7e2644d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion baking/src/tezos_baking/tezos_setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import readline
import re
import traceback
import time
import urllib.request
import json
from typing import List
Expand Down Expand Up @@ -574,6 +575,8 @@ def import_snapshot(self):
for name, url in default_providers.items():
self.get_snapshot_metadata(name, url)

os.makedirs(TMP_SNAPSHOT_LOCATION, exist_ok=True)

else:
return

Expand All @@ -589,7 +592,11 @@ def import_snapshot(self):
return
elif self.config["snapshot_mode"] == "file":
self.query_step(snapshot_file_query)
snapshot_file = self.config["snapshot_file"]
snapshot_file = os.path.join(
TMP_SNAPSHOT_LOCATION, f"file-{time.time()}.snapshot"
)
# not copying since it can take a lot of time
os.link(self.config["snapshot_file"], snapshot_file)
elif self.config["snapshot_mode"] == "direct url":
self.query_step(snapshot_url_query)
url = self.config["snapshot_url"]
Expand Down
4 changes: 2 additions & 2 deletions baking/src/tezos_baking/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def dirpath(input):


def filepath(input):
if input and not os.path.isfile(input):
if input and not os.path.isfile(os.path.expanduser(input)):
raise ValueError("Please input a valid file path.")
return input
return os.path.expanduser(input)


def reachable_url(suffix=None):
Expand Down

0 comments on commit 7e2644d

Please sign in to comment.