original_docstring: Attempt to load a world file. Look in the literal path first, then look
      in the typical save directory for the given platform. Check to see if the
      mcdungeon cache directory exists, and create it if not.
docstring: Attempt to load a world file. Look in the literal path first, then look
  in the typical save directory for the given platform. Check to see if the
  mcdungeon cache directory exists, and create it if not.
docstring_tokens: Attempt to load a world file . Look in the literal path first then look in the typical save directory for the given platform . Check to see if the mcdungeon cache directory exists and create it if not .
code: def loadWorld(world_name):
      '''Attempt to load a world file. Look in the literal path first, then look
      in the typical save directory for the given platform. Check to see if the
      mcdungeon cache directory exists, and create it if not.'''
      # Attempt to open the world. Look in cwd first, then try to search the
      # user's save directory.
      global cfg
      global cache_path
  
      world = None
      try:
          print "Trying to open:", world_name
          world = mclevel.fromFile(world_name)
          oworld = ov_world.World(world_name)
      except:
          saveFileDir = mclevel.saveFileDir
          world_name = os.path.join(saveFileDir, world_name)
          print "Trying to open:", world_name
          try:
              world = mclevel.fromFile(world_name)
              oworld = ov_world.World(world_name)
          except:
              print "Failed to open world:", world_name
              sys.exit(1)
      print 'Loaded world: %s (%d chunks, %d blocks high)' % (world_name,
                                                              world.chunkCount,
                                                              world.Height)
      # Create the mcdungeon cache dir if needed.
      cache_path = os.path.join(world_name, cfg.cache_dir)
      if os.path.exists(cache_path) is False:
          os.makedirs(cache_path)
  
      # Find the mapstore path
      print 'Looking for data directory:', os.path.join(cfg.mapstore, 'data')
      if not os.path.exists(os.path.join(cfg.mapstore, 'data')):
          cfg.mapstore = os.path.join(mclevel.saveFileDir, cfg.mapstore)
          print 'Looking for data directory:', os.path.join(cfg.mapstore, 'data')
          if not os.path.exists(os.path.join(cfg.mapstore, 'data')):
              print "Cannot find world data directory!"
              sys.exit(1)
  
      return world, oworld
code_tokens: def loadWorld ( world_name ) : global cfg global cache_path world = None try : print "Trying to open:" , world_name world = mclevel . fromFile ( world_name ) oworld = ov_world . World ( world_name ) except : saveFileDir = mclevel . saveFileDir world_name = os . path . join ( saveFileDir , world_name ) print "Trying to open:" , world_name try : world = mclevel . fromFile ( world_name ) oworld = ov_world . World ( world_name ) except : print "Failed to open world:" , world_name sys . exit ( 1 ) print 'Loaded world: %s (%d chunks, %d blocks high)' % ( world_name , world . chunkCount , world . Height ) cache_path = os . path . join ( world_name , cfg . cache_dir ) if os . path . exists ( cache_path ) is False : os . makedirs ( cache_path ) print 'Looking for data directory:' , os . path . join ( cfg . mapstore , 'data' ) if not os . path . exists ( os . path . join ( cfg . mapstore , 'data' ) ) : cfg . mapstore = os . path . join ( mclevel . saveFileDir , cfg . mapstore ) print 'Looking for data directory:' , os . path . join ( cfg . mapstore , 'data' ) if not os . path . exists ( os . path . join ( cfg . mapstore , 'data' ) ) : print "Cannot find world data directory!" sys . exit ( 1 ) return world , oworld
short_docstring: Attempt to load a world file.
short_docstring_tokens: Attempt to load a world file .
comment: '''Attempt to load a world file. Look in the literal path first, then look
      in the typical save directory for the given platform. Check to see if the
      mcdungeon cache directory exists, and create it if not.'''$SEP$# Attempt to open the world. Look in cwd first, then try to search the$SEP$# user's save directory.$SEP$# Create the mcdungeon cache dir if needed.$SEP$# Find the mapstore path