Skip to content

Commit f65f120

Browse files
committed
Safely create the dir using exist_ok=True
1 parent 3de1378 commit f65f120

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

shiny/_main_create.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,7 @@ def copy_template_files(
775775
)
776776
sys.exit(1)
777777

778-
if not dest_dir.exists():
779-
dest_dir.mkdir()
778+
dest_dir.mkdir(parents=True, exist_ok=True)
780779

781780
for item in template.path.iterdir():
782781
if item.is_file():

shiny/bookmark/_bookmark_state.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ def _local_dir(id: str) -> Path:
1212

1313
async def local_save_dir(id: str) -> Path:
1414
state_dir = _local_dir(id)
15-
if not state_dir.exists():
16-
state_dir.mkdir(parents=True)
15+
state_dir.mkdir(parents=True, exist_ok=True)
1716
return state_dir
1817

1918

0 commit comments

Comments
 (0)