forked from mirror/Archipelago
I didn't quite think this through: In this specific case, you want the gitignore to also ignore itself, since it itself is an auto-generated file.
22 lines
602 B
Python
22 lines
602 B
Python
from pathlib import Path
|
|
|
|
from Utils import user_path
|
|
|
|
|
|
def make_data_directory(dir_name: str) -> Path:
|
|
root_directory = Path(user_path())
|
|
if not root_directory.exists():
|
|
raise FileNotFoundError(f"Unable to find AP directory {root_directory.absolute()}.")
|
|
|
|
data_directory = root_directory / "data"
|
|
|
|
specific_data_directory = data_directory / "apquest" / dir_name
|
|
specific_data_directory.mkdir(parents=True, exist_ok=True)
|
|
|
|
gitignore = specific_data_directory / ".gitignore"
|
|
|
|
with open(gitignore, "w") as f:
|
|
f.write("*\n")
|
|
|
|
return specific_data_directory
|