fix bug in #715
This commit is contained in:
parent
50c392c197
commit
9b6bc26144
|
@ -2426,7 +2426,8 @@ class MyForm(QtGui.QMainWindow):
|
|||
if shared.appdata != '' and self.settingsDialogInstance.ui.checkBoxPortableMode.isChecked(): # If we are NOT using portable mode now but the user selected that we should...
|
||||
# Write the keys.dat file to disk in the new location
|
||||
sqlStoredProcedure('movemessagstoprog')
|
||||
shared.writeKeysFile()
|
||||
with open('keys.dat', 'wb') as configfile:
|
||||
shared.config.write(configfile)
|
||||
# Write the knownnodes.dat file to disk in the new location
|
||||
shared.knownNodesLock.acquire()
|
||||
output = open('knownnodes.dat', 'wb')
|
||||
|
|
|
@ -850,12 +850,17 @@ def writeKeysFile():
|
|||
fileName = shared.appdata + 'keys.dat'
|
||||
fileNameBak = fileName + "." + datetime.datetime.now().strftime("%Y%j%H%M%S%f") + '.bak'
|
||||
# create a backup copy to prevent the accidental loss due to the disk write failure
|
||||
shutil.copyfile(fileName, fileNameBak)
|
||||
try:
|
||||
shutil.copyfile(fileName, fileNameBak)
|
||||
# The backup succeeded. This can fail if the file didn't exist before.
|
||||
existingFileNameExisted = True
|
||||
except:
|
||||
existingFileNameExisted = False
|
||||
# write the file
|
||||
with open(fileName, 'wb') as configfile:
|
||||
shared.config.write(configfile)
|
||||
# delete a backup
|
||||
os.remove(fileNameBak)
|
||||
if existingFileNameExisted:
|
||||
os.remove(fileNameBak)
|
||||
|
||||
helper_startup.loadConfig()
|
||||
from debug import logger
|
||||
|
|
Loading…
Reference in New Issue
Block a user