blob: 8e5d90ef8fcb91ad79094ac4fc47516fbca76467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import os
import sys
import shutil
def create_dir(path: str, p: bool=False) -> None:
try:
if p:
os.makedirs(path)
else:
os.mkdir(path)
print(f'created directory "{path}"')
except FileExistsError:
print(f'directory "{path}" already exists')
def copy_file(src: str, dst: str) -> None:
if not os.path.exists(dst):
shutil.copy(src, dst)
print(f'copied file "{src}" to "{dst}"')
else:
print(f'"{dst}" already exists')
def sanity_check_path(path: str) -> None:
if '$' in path:
print(f'"$" character found in path: "{path}"; could be due to non-existant env var.')
sys.exit(1)
|