def GetAppDocumentsPath(self, app_bundle_id):
    "Gets the path of the app's Documents directory."
    if (xcode_info_util.GetXcodeVersionNumber() >= 830):
        try:
            app_data_container = RunSimctlCommand(['xcrun', 'simctl', 'get_app_container', self._simulator_id, app_bundle_id, 'data'])
            return os.path.join(app_data_container, 'Documents')
        except ios_errors.SimError as e:
            raise ios_errors.SimError(('Failed to get data container of the app %s in simulator %s: %s' % (app_bundle_id, self._simulator_id, str(e))))
    apps_dir = os.path.join(self.simulator_root_dir, 'data/Containers/Data/Application')
    for sub_dir_name in os.listdir(apps_dir):
        container_manager_plist = plist_util.Plist(os.path.join(apps_dir, sub_dir_name, '.com.apple.mobile_container_manager.metadata.plist'))
        current_app_bundle_id = container_manager_plist.GetPlistField('MCMMetadataIdentifier')
        if (current_app_bundle_id == app_bundle_id):
            return os.path.join(apps_dir, sub_dir_name, 'Documents')
    raise ios_errors.SimError(('Failed to get Documents directory of the app %s in simulator %s' % (app_bundle_id, self._simulator_id)))
Gets the path of the app's Documents directory.
def GetAppDocumentsPath(self, app_bundle_id):
    
    if (xcode_info_util.GetXcodeVersionNumber() >= 830):
        try:
            app_data_container = RunSimctlCommand(['xcrun', 'simctl', 'get_app_container', self._simulator_id, app_bundle_id, 'data'])
            return os.path.join(app_data_container, 'Documents')
        except ios_errors.SimError as e:
            raise ios_errors.SimError(('Failed to get data container of the app %s in simulator %s: %s' % (app_bundle_id, self._simulator_id, str(e))))
    apps_dir = os.path.join(self.simulator_root_dir, 'data/Containers/Data/Application')
    for sub_dir_name in os.listdir(apps_dir):
        container_manager_plist = plist_util.Plist(os.path.join(apps_dir, sub_dir_name, '.com.apple.mobile_container_manager.metadata.plist'))
        current_app_bundle_id = container_manager_plist.GetPlistField('MCMMetadataIdentifier')
        if (current_app_bundle_id == app_bundle_id):
            return os.path.join(apps_dir, sub_dir_name, 'Documents')
    raise ios_errors.SimError(('Failed to get Documents directory of the app %s in simulator %s' % (app_bundle_id, self._simulator_id)))