[#3075|Console] Fix config handling windows paths

The console config token parser was unable to handle windows paths
starting with 'C:'.
This commit is contained in:
Calum Lind 2017-11-05 15:25:21 +00:00
parent bcc7a74725
commit e33a8fbea4

View file

@ -34,6 +34,7 @@
#
#
from deluge.common import windows_check
from deluge.ui.console.main import BaseCommand
import deluge.ui.console.colors as colors
from deluge.ui.client import client
@ -42,6 +43,7 @@ from deluge.log import LOG as log
from optparse import make_option
import re
import string
import cStringIO, tokenize
@ -77,7 +79,11 @@ def atom(next, token):
return False
elif token[0] is tokenize.STRING or token[1] == "/":
return token[-1].decode("string-escape")
elif windows_check() and token[1].lower() in string.lowercase:
# Parse Windows paths e.g. 'C:\xyz'.
token = next()
if token[1] == ":":
return token[-1].decode("string-escape")
raise SyntaxError("malformed expression (%s)" % token[1])
def simple_eval(source):