Source code for mcph.file_manager.local
"""Module for LocalFileManager class."""
from os import listdir
from typing import List
from zipfile import ZipFile
from mcph.file_manager.abstract import AbstractFileManager
[docs]class LocalFileManager(AbstractFileManager):
"""File manager for local files."""
[docs] def open_jar(self, jar_file: str) -> bytes:
"""Open specified jar.
Args:
jar_file: Path to plugin in jar.
Returns:
Raw text from plugin.yml.
"""
with ZipFile(jar_file, "r") as opened_jar_file:
# FIXME See what it return, and continue code
return opened_jar_file.read("plugin.yml")
[docs] def get_all_files(self, path: str) -> List[str]:
"""List with all files in path.
Args:
path: Path to folder for list of all files.
Returns:
List with all files in folder.
"""
return listdir(path)