Commit 75c37b81 authored by juga's avatar juga
Browse files

Remove v3bw file link if it exist

also fix link path
parent 0db63293
......@@ -402,14 +402,21 @@ class V3BwFile(object):
def write(self, output):'Writing v3bw file to %s', output)
out_dir = os.path.dirname(output)
out_link = os.path.join(out_dir, 'latest.v3bw')
if os.path.exists(out_link):
log.debug('Deleting existing symlink before creating a new one.')
# to keep working
if output != '/dev/stdout':
with DirectoryLock(os.path.dirname(output)):
with DirectoryLock(out_dir):
with open(output, 'wt') as fd:
for line in self.bw_lines:
os.symlink(output, 'latest.v3bw')
log.debug('Creating symlink from {} to {}.'
.format(output, out_link))
os.symlink(output, out_link)
with open(output, 'wt') as fd:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment