mirror of https://github.com/borgbackup/borg.git
Accept absolute paths on windows
Accept absolute repo paths on windows.
This commit is contained in:
parent
cccee36a60
commit
8e855ecb8a
|
@ -22,6 +22,7 @@ from .time import OutputTimestamp, format_time, to_localtime, safe_timestamp, sa
|
||||||
from .. import __version__ as borg_version
|
from .. import __version__ as borg_version
|
||||||
from .. import __version_tuple__ as borg_version_tuple
|
from .. import __version_tuple__ as borg_version_tuple
|
||||||
from ..constants import * # NOQA
|
from ..constants import * # NOQA
|
||||||
|
from ..platformflags import is_win32
|
||||||
|
|
||||||
|
|
||||||
def bin_to_hex(binary):
|
def bin_to_hex(binary):
|
||||||
|
@ -377,6 +378,14 @@ class Location:
|
||||||
| # or
|
| # or
|
||||||
""" + optional_archive_re, re.VERBOSE) # archive name (optional, may be empty)
|
""" + optional_archive_re, re.VERBOSE) # archive name (optional, may be empty)
|
||||||
|
|
||||||
|
win_file_re = re.compile(r"""
|
||||||
|
(?:file://)? # optional file protocol
|
||||||
|
(?P<path>
|
||||||
|
(?:[a-zA-Z]:)? # Drive letter followed by a colon (optional)
|
||||||
|
(?:[^:]+) # Anything which does not contain a :, at least one character
|
||||||
|
)
|
||||||
|
""" + optional_archive_re, re.VERBOSE) # archive name (optional, may be empty)
|
||||||
|
|
||||||
def __init__(self, text=''):
|
def __init__(self, text=''):
|
||||||
if not self.parse(text):
|
if not self.parse(text):
|
||||||
raise ValueError('Invalid location format: "%s"' % self.orig)
|
raise ValueError('Invalid location format: "%s"' % self.orig)
|
||||||
|
@ -405,6 +414,17 @@ class Location:
|
||||||
p = os.path.normpath(p)
|
p = os.path.normpath(p)
|
||||||
return ('/.' + p) if relative else p
|
return ('/.' + p) if relative else p
|
||||||
|
|
||||||
|
if is_win32:
|
||||||
|
m = self.win_file_re.match(text)
|
||||||
|
if m:
|
||||||
|
self.proto = 'file'
|
||||||
|
self.path = path
|
||||||
|
self.archive = m.group('archive')
|
||||||
|
return True
|
||||||
|
|
||||||
|
# On windows we currently only support windows paths
|
||||||
|
return False
|
||||||
|
|
||||||
m = self.ssh_re.match(text)
|
m = self.ssh_re.match(text)
|
||||||
if m:
|
if m:
|
||||||
self.proto = m.group('proto')
|
self.proto = m.group('proto')
|
||||||
|
|
|
@ -106,6 +106,8 @@ def are_fifos_supported():
|
||||||
pass
|
pass
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
pass
|
pass
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue