ehmatthes / intro_programming

A set of IPython notebooks and learning resources for an Introduction to Programming class, focusing on Python.
MIT License
396 stars 198 forks source link

Will this ever overwrite a user's directory accidentally? #145

Open ehmatthes opened 7 years ago

ehmatthes commented 7 years ago

Right now build_html.py is going to delete the folder html_site, and rebuild it. Is this done safely?

I'm wondering if the script might ever be run from a context where the cwd is not the project root. It will look for a folder called html_site, and delete it and rebuild it. That would be terrible if the user had a different directory of that name, and lost it by running this script.

Would it be better to build an absolute path to this project's html_site, and use that path? Maybe get the absolute path to build_html.py, and use that to build the absolute path to html_site? Here are the relevant lines from build_html.py:

print("\nDeleting current html_site directory...")
try:
    rmtree('html_site')
    print("  Deleted html_site.")
except FileNotFoundError:
    print("  No html_site directory found.")