mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-28 02:23:52 +02:00
Merge pull request #826 from mannaandpoem/dev_compatible_with_windows_path
modify re.sub(r"\\+", '/') to as_posix()
This commit is contained in:
commit
0118712ff8
1 changed files with 6 additions and 7 deletions
|
|
@ -60,23 +60,22 @@ class DependencyFile:
|
|||
|
||||
root = self._filename.parent
|
||||
try:
|
||||
key = Path(filename).relative_to(root)
|
||||
key = Path(filename).relative_to(root).as_posix()
|
||||
except ValueError:
|
||||
key = filename
|
||||
skey = re.sub(r"\\+", "/", str(key)) # Compatible with windows path
|
||||
key = str(key)
|
||||
if dependencies:
|
||||
relative_paths = []
|
||||
for i in dependencies:
|
||||
try:
|
||||
s = str(Path(i).relative_to(root))
|
||||
s = str(Path(i).relative_to(root).as_posix())
|
||||
except ValueError:
|
||||
s = str(i)
|
||||
s = re.sub(r"\\+", "/", s) # Compatible with windows path
|
||||
relative_paths.append(s)
|
||||
|
||||
self._dependencies[skey] = relative_paths
|
||||
elif skey in self._dependencies:
|
||||
del self._dependencies[skey]
|
||||
self._dependencies[key] = relative_paths
|
||||
elif key in self._dependencies:
|
||||
del self._dependencies[key]
|
||||
|
||||
if persist:
|
||||
await self.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue