From e33a8fbea46e2bec9df6c0c777cd25b7bb0d9e06 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 5 Nov 2017 15:25:21 +0000 Subject: [PATCH] [#3075|Console] Fix config handling windows paths The console config token parser was unable to handle windows paths starting with 'C:'. --- deluge/ui/console/commands/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deluge/ui/console/commands/config.py b/deluge/ui/console/commands/config.py index 5d8a6ef62..0b3996bd4 100644 --- a/deluge/ui/console/commands/config.py +++ b/deluge/ui/console/commands/config.py @@ -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):