changeset 3028:9a201c63a0eb

Implementation for #231
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 19 Sep 2017 20:26:54 +0300
parents b09e9b7ef246
children 192538967e67
files php/requestKey.php python/pythonServer.py
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/php/requestKey.php	Thu Sep 14 13:14:00 2017 +0100
+++ b/php/requestKey.php	Tue Sep 19 20:26:54 2017 +0300
@@ -11,6 +11,10 @@
     return $randomString;
 }
 
+if (!file_exists("../saves")) {
+    mkdir("../saves");
+}
+
 // Request a new session key from the server
 header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
 header("Cache-Control: post-check=0, pre-check=0", false);
--- a/python/pythonServer.py	Thu Sep 14 13:14:00 2017 +0100
+++ b/python/pythonServer.py	Tue Sep 19 20:26:54 2017 +0300
@@ -13,6 +13,7 @@
 import copy
 import string
 import random
+import errno
 
 if sys.version_info[0] == 2:
     # Version 2.x
@@ -28,6 +29,12 @@
 scriptdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # script directory
 os.chdir(scriptdir) # does this work?
 
+try:
+    os.makedirs("../saves")
+except OSError as e:
+    if e.errno != errno.EEXIST:
+        raise
+
 PSEUDO_PATH = '../tests/'
 pseudo_files = []
 pseudo_index = 0