summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-11-05 15:25:21 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2017-11-05 15:27:09 +0000
commite33a8fbea46e2bec9df6c0c777cd25b7bb0d9e06 (patch)
tree2d0e5d70d3043e5f5eecf66c702500c4854749e5
parentbcc7a74725abcdbd43b00689c3705bffe7e48480 (diff)
downloaddeluge-e33a8fbea46e2bec9df6c0c777cd25b7bb0d9e06.tar.gz
deluge-e33a8fbea46e2bec9df6c0c777cd25b7bb0d9e06.tar.bz2
deluge-e33a8fbea46e2bec9df6c0c777cd25b7bb0d9e06.zip
[#3075|Console] Fix config handling windows paths
The console config token parser was unable to handle windows paths starting with 'C:'.
-rw-r--r--deluge/ui/console/commands/config.py8
1 files changed, 7 insertions, 1 deletions
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):