def userdata_directory_for_user_id(user_id): """ Returns the path to the userdata directory for a specific user The userdata directory is where Steam keeps information specific to certain users. Of special note for Ice is the config/shortcuts.vdf file, which contains all of the 'Non-Steam Games' shortcuts. """ return os.path.join(steam_installation_location_manager.steam_userdata_location(),str(user_id))
def userdata_directory_for_user_id(user_id): """ Returns the path to the userdata directory for a specific user The userdata directory is where Steam keeps information specific to certain users. Of special note for Ice is the config/shortcuts.vdf file, which contains all of the 'Non-Steam Games' shortcuts. """ return os.path.join( steam_installation_location_manager.steam_userdata_location(), str(user_id))
def test_userdata_directory_for_user_id(self): """ The userdata directory for a user_id should be in the userdata directory for the given Steam installation, and the directory should be named the same as the user id """ ud_dir = userdata_directory_for_user_id(self.community_id_32) # dirname removes the trailing /, which I keep in # steam_userdata_location, so I add that back on for the equality check self.assertEqual(os.path.dirname(ud_dir)+os.sep,steam_installation_location_manager.steam_userdata_location()) self.assertEqual(int(os.path.basename(ud_dir)),self.community_id_32)
def user_ids_on_this_machine(): """ Reads the userdata folder to find a list of IDs of Users on this machine. This function returns the user_ids in the communityid32 format, so use those related methods to convert to other formats The userdata folder contains a bunch of directories that are all 32 bit community ids, so to find a list of ids on the machine we simply find a list of subfolders inside the userdata folder """ ids = [] userdata_dir = steam_installation_location_manager.steam_userdata_location() for entry in os.listdir(userdata_dir): if os.path.isdir(os.path.join(userdata_dir,entry)): ids.append(int(entry)) return ids
def user_ids_on_this_machine(): """ Reads the userdata folder to find a list of IDs of Users on this machine. This function returns the user_ids in the communityid32 format, so use those related methods to convert to other formats The userdata folder contains a bunch of directories that are all 32 bit community ids, so to find a list of ids on the machine we simply find a list of subfolders inside the userdata folder """ ids = [] userdata_dir = steam_installation_location_manager.steam_userdata_location( ) for entry in os.listdir(userdata_dir): if os.path.isdir(os.path.join(userdata_dir, entry)): ids.append(int(entry)) return ids