def list_directory(self, directory): r = [] prefix = "" if not directory: if os.name == "nt": drives = get_windows_drives() return [drive + ":\\" for drive in drives] else: directory = "/" prefix = "/" for de in os.scandir(directory): if de.is_dir(): r.append(prefix + de.name + os.path.sep) else: r.append(prefix + de.name) return r