Skip to content

Commit

Permalink
posixfs: also accept relative paths, see #23
Browse files Browse the repository at this point in the history
URLS now might look like:
- file:///absolute/path
- file://relative/path (*)

Internally, PosixFS now:
- accepts relative paths as path argument
- always works with an absolute .base_path internally

(*) not sure if that is the final solution, consider
this as a temporary hack.
  • Loading branch information
ThomasWaldmann committed Sep 10, 2024
1 parent 0592c7a commit 9ad608a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/borgstore/backends/posixfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@


def get_file_backend(url):
# file:///var/backups/borgstore/first
# file:///absolute/path or file://relative/path
file_regex = r"""
file://
(?P<path>(/.*))
(?P<path>(.*))
"""
m = re.match(file_regex, url, re.VERBOSE)
if m:
Expand All @@ -27,7 +27,7 @@ def get_file_backend(url):

class PosixFS(BackendBase):
def __init__(self, path, *, do_fsync=False):
self.base_path = Path(path)
self.base_path = Path(path).absolute()
self.opened = False
self.do_fsync = do_fsync # False = 26x faster, see #10

Expand Down

0 comments on commit 9ad608a

Please sign in to comment.