Fix trayicon auto start script write/read with utf8 path
This commit is contained in:
parent
32855d0479
commit
fca1033f83
1 changed files with 9 additions and 9 deletions
|
@ -140,17 +140,17 @@ class ActionsPlugin(object):
|
||||||
cmd = cmd.replace("start.py", "zeronet.py").replace('"--open_browser"', "").replace('"default_browser"', "").strip()
|
cmd = cmd.replace("start.py", "zeronet.py").replace('"--open_browser"', "").replace('"default_browser"', "").strip()
|
||||||
cmd += ' --open_browser ""'
|
cmd += ' --open_browser ""'
|
||||||
|
|
||||||
return """
|
return "\r\n".join([
|
||||||
@echo off
|
'@echo off',
|
||||||
chcp 65001 > nul
|
'chcp 65001 > nul',
|
||||||
set PYTHONIOENCODING=utf-8
|
'set PYTHONIOENCODING=utf-8',
|
||||||
cd /D \"%s\"
|
'cd /D \"%s\"' % cwd,
|
||||||
start "" %s
|
'start "" %s' % cmd
|
||||||
""" % (cwd, cmd)
|
])
|
||||||
|
|
||||||
def isAutorunEnabled(self):
|
def isAutorunEnabled(self):
|
||||||
path = self.getAutorunPath()
|
path = self.getAutorunPath()
|
||||||
return os.path.isfile(path) and open(path).read() == self.formatAutorun()
|
return os.path.isfile(path) and open(path, "rb").read().decode("utf8") == self.formatAutorun()
|
||||||
|
|
||||||
def titleAutorun(self):
|
def titleAutorun(self):
|
||||||
translate = _["Start ZeroNet when Windows starts"]
|
translate = _["Start ZeroNet when Windows starts"]
|
||||||
|
@ -163,4 +163,4 @@ class ActionsPlugin(object):
|
||||||
if self.isAutorunEnabled():
|
if self.isAutorunEnabled():
|
||||||
os.unlink(self.getAutorunPath())
|
os.unlink(self.getAutorunPath())
|
||||||
else:
|
else:
|
||||||
open(self.getAutorunPath(), "w").write(self.formatAutorun())
|
open(self.getAutorunPath(), "wb").write(self.formatAutorun().encode("utf8"))
|
||||||
|
|
Loading…
Reference in a new issue