from parallels.plesk.source.web.utils.list_files.base import ListFilesBase


class ListFilesFilesystemRunner(ListFilesBase):
    def list_files(self, source):
        """
        :type source: parallels.plesk.source.web.connections.WebSource
        :rtype: list
        """
        with source.filesystem_runner() as runner:
            return runner.get_dir_tree(source.get_files_root())
        
    def get_encoding(self, source):
        """Get encoding in which "list_files" function is expected to return file names.

        :type source: parallels.plesk.source.web.connections.WebSource
        :rtype: str
        """
        return source.get_filesystem_runner_encoding()
