Ejemplo n.º 1
0
    def validate_environment(self, app_settings, users):
        """
        Validate that the current environment meets all of Ice's requirements.
        """
        with EnvironmentChecker(self.filesystem) as env_checker:
            if not self.skip_steam_check:
                # If Steam is running then any changes we make will be overwritten
                env_checker.require_program_not_running("Steam")
            else:
                logger.warning(STEAM_CHECK_SKIPPED_WARNING)
            # This is used to store history information and such
            env_checker.require_directory_exists(paths.application_data_directory())

            for console in app_settings.consoles:
                # Consoles assume they have a ROMs directory
                env_checker.require_directory_exists(
                    consoles.console_roms_directory(app_settings.config, console)
                )

            for user in users:
                # I'm not sure if there are situations where this won't exist, but I
                # assume that it does everywhere and better safe than sorry
                env_checker.require_directory_exists(user.steam.userdata_directory)
                # If the user hasn't added any grid images on their own then this
                # directory wont exist, so we require it explicitly here
                env_checker.require_directory_exists(
                    steam_paths.custom_images_directory(user)
                )
                # And it needs to be writable if we are going to save images there
                env_checker.require_writable_path(
                    steam_paths.custom_images_directory(user)
                )
Ejemplo n.º 2
0
  def validate_environment(self, skip_steam_check):
    """
    Validate that the current environment meets all of Ice's requirements.
    """
    with EnvironmentChecker(self.filesystem) as env_checker:
      if not skip_steam_check:
        # If Steam is running then any changes we make will be overwritten
        env_checker.require_program_not_running("Steam")
      else:
        logger.warning(STEAM_CHECK_SKIPPED_WARNING)
      # I'm not sure if there are situations where this won't exist, but I
      # assume that it does everywhere and better safe than sorry
      env_checker.require_directory_exists(self.steam.userdata_directory)
      # This is used to store history information and such
      env_checker.require_directory_exists(paths.application_data_directory())

      for console in self.app_settings.consoles:
        # Consoles assume they have a ROMs directory
        env_checker.require_directory_exists(consoles.console_roms_directory(self.app_settings.config, console))

      for user in self.users:
        # If the user hasn't added any grid images on their own then this
        # directory wont exist, so we require it explicitly here
        env_checker.require_directory_exists(steam_paths.custom_images_directory(user))
        # And it needs to be writable if we are going to save images there
        env_checker.require_writable_path(steam_paths.custom_images_directory(user))
Ejemplo n.º 3
0
 def validate_user_environment(self, user):
   """
   Validate that the current environment for a given user meets all of
   Ice's requirements.
   """
   with EnvironmentChecker(self.filesystem) as env_checker:
     # If the user hasn't added any grid images on their own then this
     # directory wont exist, so we require it explicitly here
     env_checker.require_directory_exists(paths.custom_images_directory(user))
     # And it needs to be writable if we are going to save images there
     env_checker.require_writable_path(paths.custom_images_directory(user))
Ejemplo n.º 4
0
 def validate_user_environment(self, user):
     """
 Validate that the current environment for a given user meets all of
 Ice's requirements.
 """
     with EnvironmentChecker(self.filesystem) as env_checker:
         # If the user hasn't added any grid images on their own then this
         # directory wont exist, so we require it explicitly here
         env_checker.require_directory_exists(
             steam_paths.custom_images_directory(user))
         # And it needs to be writable if we are going to save images there
         env_checker.require_writable_path(
             steam_paths.custom_images_directory(user))
Ejemplo n.º 5
0
 def _create_default_directories(self):
   """This method creates all of the directories that Steam normally creates
   for a user."""
   # Assert that the userdata directory is there
   assert(os.path.exists(self.steam_fixture.get_steam().userdata_directory))
   # The data directory for our user, which acts as the root of userdata
   # hierarchy
   os.mkdir(paths.user_specific_data_directory(self.get_context()))
   # The "config" directory, which stores shortcuts.vdf and the grid directory
   # TODO: There should probably be a helper function for this in pysteam
   os.mkdir(os.path.join(paths.user_specific_data_directory(self.get_context()), "config"))
   # The directory which stores grid images
   os.mkdir(paths.custom_images_directory(self.get_context()))
Ejemplo n.º 6
0
 def _create_default_directories(self):
     """This method creates all of the directories that Steam normally creates
 for a user."""
     # Assert that the userdata directory is there
     assert (os.path.exists(
         self.steam_fixture.get_steam().userdata_directory))
     # The data directory for our user, which acts as the root of userdata
     # hierarchy
     os.mkdir(paths.user_specific_data_directory(self.get_context()))
     # The "config" directory, which stores shortcuts.vdf and the grid directory
     # TODO: There should probably be a helper function for this in pysteam
     os.mkdir(
         os.path.join(
             paths.user_specific_data_directory(self.get_context()),
             "config"))
     # The directory which stores grid images
     os.mkdir(paths.custom_images_directory(self.get_context()))
Ejemplo n.º 7
0
 def _custom_image_path(self, app_id, extension):
   return os.path.join(
     paths.custom_images_directory(self.context),
     "%s%s" % (app_id, extension)
   )
Ejemplo n.º 8
0
 def setUp(self):
   self.tempdir = tempfile.mkdtemp()
   s = model.Steam(self.tempdir)
   self.context = model.LocalUserContext(s, '1234')
   os.makedirs(paths.custom_images_directory(self.context))
Ejemplo n.º 9
0
 def _custom_image_path(self, app_id, extension):
     return os.path.join(paths.custom_images_directory(self.context),
                         "%s%s" % (app_id, extension))
Ejemplo n.º 10
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp()
     s = model.Steam(self.tempdir)
     self.context = model.LocalUserContext(s, '1234')
     os.makedirs(paths.custom_images_directory(self.context))