Hemiptera Bugtracker at bugs.linux-forks.de


Save system: Nodedb also has platform-dependent code

Send replies to 153@bugs.linux-forks.de or using the Form below.
avatar From: OP
Sun, 07 Jun 2020 13:29:01 -0000

While the rest of the save files were fixed with #142, the nodedb,

specifically advtrains_ndb2, has a minor issue on windows.


84: tmppath = path .. "~"

85: local file, err = io.open(tmppath, "wb")


101: os.rename(tmppath, path)

The old file is not deleted before moving the ~file to the target,

resulting in a failed operation on windows. Same root cause as #142, less

immediate effect since nothing breaks visibly on reload but

advtrains_netmapper will read out-of-date data. Since the os.rename call is

meant to clobber the `path` file anyway, I suggest the following line also

be added:

101: os.remove(path)

102: os.rename(tmppath,path)

If this seems too dangerous, remember that it is not really any more

dangerous in intent than clobbering the file, so you should take a more

careful approach to the save operation and make sure it is