Skip to content

Commit 9a267ff

Browse files
committed
Rev4016, Fix updater
1 parent 6254143 commit 9a267ff

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/Config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Config(object):
1313

1414
def __init__(self, argv):
1515
self.version = "0.7.0"
16-
self.rev = 4104
16+
self.rev = 4106
1717
self.argv = argv
1818
self.action = None
1919
self.pending_changes = {}

update.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def update():
8383
num_error = 0
8484
for path_from, path_to in update_paths.items():
8585
print("-", path_from, "->", path_to)
86+
if not os.path.isfile(path_from):
87+
print("Missing file")
88+
continue
89+
8690
data = open(path_from, "rb").read()
8791

8892
try:
@@ -108,4 +112,4 @@ def update():
108112
if __name__ == "__main__":
109113
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src")) # Imports relative to src
110114

111-
update()
115+
update()

zeronet.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ def main():
3131
if main and (main.update_after_shutdown or main.restart_after_shutdown): # Updater
3232
if main.update_after_shutdown:
3333
import update
34-
if sys.platform.startswith("win"):
35-
update.update(restart_win=True)
36-
else:
37-
update.update()
38-
restart()
34+
update.update()
35+
restart()
3936
else:
4037
print("Restarting...")
4138
restart()
@@ -56,13 +53,26 @@ def restart():
5653
import time
5754
time.sleep(1) # Wait files to close
5855

59-
args = [arg for arg in sys.argv[:] if arg not in ("--open_browser", "default_browser")]
56+
args = sys.argv[:]
6057

6158
sys.executable = sys.executable.replace(".pkg", "") # Frozen mac fix
6259

6360
if not getattr(sys, 'frozen', False):
6461
args.insert(0, sys.executable)
6562

63+
# Don't open browser after restart
64+
if "--open_browser" in args:
65+
del args[args.index("--open_browser") + 1] # argument value
66+
del args[args.index("--open_browser")] # argument key
67+
68+
if getattr(sys, 'frozen', False):
69+
pos_first_arg = 1 # Only the executable
70+
else:
71+
pos_first_arg = 2 # Interpter, .py file path
72+
73+
args.insert(pos_first_arg, "--open_browser")
74+
args.insert(pos_first_arg + 1, "False")
75+
6676
if sys.platform == 'win32':
6777
args = ['"%s"' % arg for arg in args]
6878

0 commit comments

Comments
 (0)