now removes dropins if the directory already exists

This commit is contained in:
Ezri Brimhall 2026-02-03 15:08:40 -07:00
parent c0e692048a
commit 98576f5b27
Signed by: ezri
GPG Key ID: 058A78E5680C6F24

View File

@ -199,8 +199,14 @@ class Config:
f"Priority={self.routingpolicyrule_prio}\n",
]
)
dir = path.with_suffix(".d")
if not dir.exists():
dir = path.with_suffix(".network.d")
if dir.is_dir():
for file in dir.iterdir():
# Remove all files in the directory.
file.unlink()
elif dir.exists():
dir.unlink()
else:
dir.mkdir()
for net in self.split_tunnel_inclusions:
self.write_route(dir, net)