mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
lyxpak: Fix the common path prefix calculation.
The old implementation could fail in some rare cases.
This commit is contained in:
parent
8a772549d7
commit
ca0ba7c6ad
@ -298,10 +298,9 @@ def main(args):
|
||||
# Find the topmost dir common to all files
|
||||
if len(incfiles) > 1:
|
||||
topdir = os.path.commonprefix(incfiles)
|
||||
# Check whether topdir is valid, as os.path.commonprefix() works on
|
||||
# a character by character basis, rather than on path elements.
|
||||
if not os.path.exists(topdir):
|
||||
topdir = os.path.dirname(topdir) + os.path.sep
|
||||
# As os.path.commonprefix() works on a character by character basis,
|
||||
# rather than on path elements, we need to remove any trailing bytes.
|
||||
topdir = topdir.rpartition(os.path.sep)[0] + os.path.sep
|
||||
else:
|
||||
topdir = os.path.dirname(incfiles[0]) + os.path.sep
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user