mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Updated python script to fix bug
This commit is contained in:
parent
4cee916c40
commit
52dfcc7093
1 changed files with 7 additions and 1 deletions
|
@ -68,14 +68,20 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
|
||||||
|
|
||||||
#TODO: Upgrade this so it works on windows
|
#TODO: Upgrade this so it works on windows
|
||||||
#These scripts will be placed in coco/bin
|
#These scripts will be placed in coco/bin
|
||||||
|
|
||||||
current_directory = os.path.dirname(os.path.realpath(sys.argv[0]))
|
current_directory = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||||
if which("mongod") and "v2.5.4" in subprocess.check_output("mongod --version",shell=True):
|
if which("mongod") and "v2.5.4" in subprocess.check_output("mongod --version",shell=True):
|
||||||
mongo_executable = "mongod"
|
mongo_executable = "mongod"
|
||||||
else:
|
else:
|
||||||
|
mongo_executable = None
|
||||||
print("Mongod 2.5.4 wasn't found. Searching in bin directory...")
|
print("Mongod 2.5.4 wasn't found. Searching in bin directory...")
|
||||||
|
|
||||||
mongo_directory = current_directory + os.sep + u"mongo"
|
mongo_directory = current_directory + os.sep + u"mongo"
|
||||||
mongo_executable = os.environ.get("COCO_MONGOD_PATH",mongo_directory + os.sep + u"mongod")
|
if not mongo_executable:
|
||||||
|
mongo_executable = os.environ.get("COCO_MONGOD_PATH",mongo_directory + os.sep + u"mongod")
|
||||||
|
if not os.path.exists(mongo_executable):
|
||||||
|
raise FileNotFoundError("Mongo executable not found.")
|
||||||
|
print("Using mongo executable: " + str(mongo_executable))
|
||||||
mongo_db_path = os.path.abspath(os.path.join(current_directory,os.pardir)) + os.sep + u"mongo"
|
mongo_db_path = os.path.abspath(os.path.join(current_directory,os.pardir)) + os.sep + u"mongo"
|
||||||
if not os.path.exists(mongo_db_path):
|
if not os.path.exists(mongo_db_path):
|
||||||
os.mkdir(mongo_db_path)
|
os.mkdir(mongo_db_path)
|
||||||
|
|
Loading…
Reference in a new issue