def set_gamedir(path):
 global GAMEDIR
 Ndepth = 10
 settings_path = os.path.join('server', 'conf', 'settings.py')
 for i in range(Ndepth):
  gpath = os.getcwd()
  if ('server' in os.listdir(gpath)):
   if os.path.isfile(settings_path):
    GAMEDIR = gpath
    return
  os.chdir(os.pardir)
 print(ERROR_NO_GAMEDIR)
 sys.exit()

def set_gamedir ( path ) : global GAMEDIR Ndepth = 10 settings_path = os . path . join ( 'server' , 'conf' , 'settings.py' ) for i in range ( Ndepth ) : gpath = os . getcwd ( ) if ( 'server' in os . listdir ( gpath ) ) : if os . path . isfile ( settings_path ) : GAMEDIR = gpath return os . chdir ( os . pardir ) print ( ERROR_NO_GAMEDIR ) sys . exit ( )
set gamedir based on path .