Skip to content

Commit

Permalink
Use fsspec local filesystem instead of pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
gutzbenj committed May 13, 2024
1 parent 6133acb commit 31da73d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fsspec/dircache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from collections.abc import MutableMapping
from enum import Enum
from functools import lru_cache
from pathlib import Path
from typing import Optional, Union

from fsspec.implementations.local import LocalFileSystem

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -129,7 +130,7 @@ class FileListingsCache(MutableMapping):
def __init__(
self,
expiry_time: Optional[int],
directory: Optional[Path],
directory: Optional[str],
):
"""
Expand All @@ -153,10 +154,12 @@ def __init__(

if not directory:
directory = platformdirs.user_cache_dir(appname="fsspec")
directory = Path(directory) / "dircache" / str(expiry_time)
directory = f"{directory}/dircache/{str(expiry_time)}"

fs = LocalFileSystem()

try:
directory.mkdir(exist_ok=True, parents=True)
fs.mkdir(directory, create_parents=True)
except OSError as e:
logger.error(f"Directory for dircache could not be created at {directory}.")
raise e
Expand Down

0 comments on commit 31da73d

Please sign in to comment.