fix: import complete sash combine chains and sync isolated db prototypes
This commit is contained in:
@@ -19,6 +19,12 @@ def install(proto,names,rows):
|
||||
newline=b'\r\n' if b'\r\n' in raw else b'\n'
|
||||
kept=[l for l in raw.replace(b'\r\n',b'\n').split(b'\n') if l and not (l.split(b'\t',1)[0].isdigit() and int(l.split(b'\t',1)[0]) in rows)]
|
||||
tmp=path.with_name(filename+'.tmp');tmp.write_bytes(newline.join(kept+[row(v) for v in sorted(rows)])+newline);tmp.replace(path)
|
||||
# Isolated clusters may use copies rather than links to share/conf.
|
||||
dbpath=server/'db'/filename
|
||||
if dbpath.is_file() and dbpath.resolve()!=path.resolve():
|
||||
dbbackup=backup/'db'/filename;dbbackup.parent.mkdir(parents=True,exist_ok=True)
|
||||
shutil.copy2(dbpath,dbbackup)
|
||||
dbtmp=dbpath.with_name(filename+'.tmp');shutil.copy2(path,dbtmp);dbtmp.replace(dbpath)
|
||||
|
||||
items=load(rows);install('item_proto.txt','item_names.txt',items)
|
||||
print('AVA2 items installed:',len(items),'backup:',backup)
|
||||
|
||||
Reference in New Issue
Block a user