aboutsummaryrefslogtreecommitdiff
path: root/src/sandbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sandbox.py')
-rw-r--r--src/sandbox.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/sandbox.py b/src/sandbox.py
new file mode 100644
index 0000000..e900076
--- /dev/null
+++ b/src/sandbox.py
@@ -0,0 +1,32 @@
+# ############################################################################ #
+# #
+# ::: :::::::: #
+# sandbox.py :+: :+: :+: #
+# +:+ +:+ +:+ #
+# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
+# +#+#+#+#+#+ +#+ #
+# Created: 2020/09/11 13:48:07 by charles #+# #+# #
+# Updated: 2020/09/11 13:50:08 by charles ### ########.fr #
+# #
+# ############################################################################ #
+
+import os
+import glob
+import shutil
+import subprocess
+
+import config
+
+def create():
+ try:
+ os.mkdir(config.SANDBOX_PATH)
+ except OSError:
+ pass
+
+
+def remove():
+ try:
+ shutil.rmtree(config.SANDBOX_PATH)
+ except:
+ subprocess.run(["chmod", "777", *glob.glob(config.SANDBOX_PATH + "/*")], check=True)
+ subprocess.run(["rm", "-rf", config.SANDBOX_PATH], check=True)