mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-06 16:38:43 +00:00
[#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:
parent
bcc7a74725
commit
e33a8fbea4
1 changed files with 7 additions and 1 deletions
|
@ -34,6 +34,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from deluge.common import windows_check
|
||||||
from deluge.ui.console.main import BaseCommand
|
from deluge.ui.console.main import BaseCommand
|
||||||
import deluge.ui.console.colors as colors
|
import deluge.ui.console.colors as colors
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
@ -42,6 +43,7 @@ from deluge.log import LOG as log
|
||||||
|
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
import re
|
import re
|
||||||
|
import string
|
||||||
|
|
||||||
import cStringIO, tokenize
|
import cStringIO, tokenize
|
||||||
|
|
||||||
|
@ -77,7 +79,11 @@ def atom(next, token):
|
||||||
return False
|
return False
|
||||||
elif token[0] is tokenize.STRING or token[1] == "/":
|
elif token[0] is tokenize.STRING or token[1] == "/":
|
||||||
return token[-1].decode("string-escape")
|
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])
|
raise SyntaxError("malformed expression (%s)" % token[1])
|
||||||
|
|
||||||
def simple_eval(source):
|
def simple_eval(source):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue