Added migration to APPDATA from LOCALAPPDATA for windows based Electrum installations
This commit is contained in:
parent
63cce2174f
commit
a30f154a9e
|
@ -9,6 +9,9 @@ older versions of Electrum.
|
|||
and Blockchain functions can be accessed through it. The goal is to
|
||||
let users extend Electrum through custom scripts.
|
||||
|
||||
* The location of the Electrum folder in Windows changed from LOCALAPPDATA
|
||||
to APPDATA. Discussion on this topic can be found here: https://bitcointalk.org/index.php?topic=144575.0
|
||||
|
||||
* New menu item to display the private key corresponding to a
|
||||
receiving address.
|
||||
|
||||
|
|
7
electrum
7
electrum
|
@ -19,6 +19,7 @@
|
|||
import re
|
||||
import sys, os, time
|
||||
import optparse
|
||||
import platform
|
||||
|
||||
try:
|
||||
import ecdsa
|
||||
|
@ -157,6 +158,11 @@ if __name__ == '__main__':
|
|||
for k, v in config_options.items():
|
||||
if v is None: config_options.pop(k)
|
||||
|
||||
# Wallet migration on Electrum 1.7
|
||||
# Todo: In time we could remove this again
|
||||
if platform.system() == "Windows":
|
||||
util.check_windows_wallet_migration()
|
||||
|
||||
config = SimpleConfig(config_options)
|
||||
wallet = Wallet(config)
|
||||
|
||||
|
@ -174,6 +180,7 @@ if __name__ == '__main__':
|
|||
#right GUI toolkit based the GUI command line option given
|
||||
if cmd == 'gui':
|
||||
pref_gui = config.get('gui','classic')
|
||||
|
||||
if pref_gui == 'gtk':
|
||||
try:
|
||||
import lib.gui as gui
|
||||
|
|
|
@ -11,9 +11,6 @@ except ImportError:
|
|||
print "If you have pip installed try 'sudo pip install pyqt' if you are on Debian/Ubuntu try 'sudo apt-get install python-qt4'."
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
||||
from decimal import Decimal as D
|
||||
from util import get_resource_path as rsrc
|
||||
from i18n import _
|
||||
|
|
20
lib/util.py
20
lib/util.py
|
@ -1,5 +1,6 @@
|
|||
import os, sys
|
||||
import platform
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
is_verbose = True
|
||||
|
||||
|
@ -68,14 +69,29 @@ def print_msg(*args):
|
|||
sys.stdout.write(" ".join(args) + "\n")
|
||||
sys.stdout.flush()
|
||||
|
||||
def check_windows_wallet_migration():
|
||||
from PyQt4.QtGui import *
|
||||
from i18n import _
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
if os.path.exists(os.path.join(os.environ["LOCALAPPDATA"], "Electrum")):
|
||||
if os.path.exists(os.path.join(os.environ["APPDATA"], "Electrum")):
|
||||
QMessageBox.information(None,_("Folder migration"), _("Two Electrum folders have been found, the default Electrum location for Windows has changed from %s to %s since Electrum 1.7, please check your wallets and fix the problem manually." % (os.environ["LOCALAPPDATA"], os.environ["APPDATA"])))
|
||||
sys.exit()
|
||||
|
||||
QMessageBox.information(None, _("Folder migration"), _("This version of Electrum moved the Electrum folder on windows from %s to %s, your Electrum folder will now be moved.") % (os.environ["LOCALAPPDATA"], os.environ["APPDATA"]))
|
||||
shutil.move(os.path.join(os.environ["LOCALAPPDATA"], "Electrum"), os.path.join(os.environ["APPDATA"], "Electrum"))
|
||||
QMessageBox.information(None,_("Migration status"), _("Your wallet has been moved sucessfully."))
|
||||
|
||||
|
||||
|
||||
def user_dir():
|
||||
if "HOME" in os.environ:
|
||||
return os.path.join(os.environ["HOME"], ".electrum")
|
||||
elif "LOCALAPPDATA" in os.environ:
|
||||
return os.path.join(os.environ["LOCALAPPDATA"], "Electrum")
|
||||
elif "APPDATA" in os.environ:
|
||||
return os.path.join(os.environ["APPDATA"], "Electrum")
|
||||
elif "LOCALAPPDATA" in os.environ:
|
||||
return os.path.join(os.environ["LOCALAPPDATA"], "Electrum")
|
||||
else:
|
||||
#raise BaseException("No home directory found in environment variables.")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue