mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-22 05:17:59 +01:00
Fix deprecation warning in resource loader
This commit is contained in:
parent
cb3a9d75b6
commit
57d53f63b1
1 changed files with 6 additions and 3 deletions
|
@ -27,7 +27,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from importlib_resources import read_binary, read_text
|
from importlib_resources import files
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import (
|
from typing import (
|
||||||
cast, Any, Callable, Dict, Iterator,
|
cast, Any, Callable, Dict, Iterator,
|
||||||
|
@ -295,7 +295,10 @@ class ResourceLoader:
|
||||||
if binary is None:
|
if binary is None:
|
||||||
binary = self.binary
|
binary = self.binary
|
||||||
|
|
||||||
|
package = files(self.package)
|
||||||
|
resource = package.joinpath(name)
|
||||||
|
|
||||||
if binary:
|
if binary:
|
||||||
return read_binary(self.package, name)
|
return resource.read_bytes()
|
||||||
else:
|
else:
|
||||||
return read_text(self.package, name)
|
return resource.read_text()
|
||||||
|
|
Loading…
Reference in a new issue