#!/usr/bin/env python3
###########################################################################################
#  package:   pNbody
#  file:      pNbody_copy-examples
#  copyright: GPLv3
#             Copyright (C) 2019 EPFL (Ecole Polytechnique Federale de Lausanne)
#             LASTRO - Laboratory of Astrophysics of EPFL
#  author:    Yves Revaz <yves.revaz@epfl.ch>
#
# This file is part of pNbody.
###########################################################################################

from pNbody import *
import shutil


EXAMPLES = os.path.join(PNBODYPATH, 'examples/snapshots')


dest = os.path.join(HOME, "pNbody_examples")


# check if .pNbody exists
if os.path.isdir(dest):
    answer = input(
        'WARNING : The directory %s alredy exists. Remove it [y/N] ? ' %
        (dest))
    if answer == "y" or answer == "Y":
        print("Removing %s" % dest)
        shutil.rmtree(dest)
    else:
        print("Nothing done.")
        sys.exit()

# recursive copy
print("copying files from %s" % EXAMPLES)
print("to %s" % dest)


shutil.copytree(EXAMPLES, dest)

print("done.")
print()
print("you can now move to %s and test the examples." % dest)
print()
