summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-11-05 17:17:00 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2017-11-05 17:28:09 +0000
commitb8e5ebe8220c8365e186127e381a2d2dbaf9e460 (patch)
tree849ec56c2ea7198e69374815ae966c9640394fe3
parente33a8fbea46e2bec9df6c0c777cd25b7bb0d9e06 (diff)
downloaddeluge-b8e5ebe8220c8365e186127e381a2d2dbaf9e460.zip
deluge-b8e5ebe8220c8365e186127e381a2d2dbaf9e460.tar.gz
deluge-b8e5ebe8220c8365e186127e381a2d2dbaf9e460.tar.bz2
[Console] Refactor console config command for windows paths
Parse windows paths regardless of console running on a windows machine.
-rw-r--r--deluge/ui/console/commands/config.py10
-rw-r--r--deluge/ui/console/main.py3
2 files changed, 5 insertions, 8 deletions
diff --git a/deluge/ui/console/commands/config.py b/deluge/ui/console/commands/config.py
index 0b3996b..fc288df 100644
--- a/deluge/ui/console/commands/config.py
+++ b/deluge/ui/console/commands/config.py
@@ -34,7 +34,6 @@
#
#
-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
@@ -43,7 +42,6 @@ from deluge.log import LOG as log
from optparse import make_option
import re
-import string
import cStringIO, tokenize
@@ -79,11 +77,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] == ":":
+ elif token[1].isalpha():
+ # Parse Windows paths e.g. 'C:\\xyz' or 'C:/xyz'.
+ if next()[1] == ":" and next()[1] in '\/':
return token[-1].decode("string-escape")
+
raise SyntaxError("malformed expression (%s)" % token[1])
def simple_eval(source):
diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py
index 34db1a9..559d7ab 100644
--- a/deluge/ui/console/main.py
+++ b/deluge/ui/console/main.py
@@ -110,8 +110,7 @@ class BaseCommand(object):
return self.__doc__
def split(self, text):
- if deluge.common.windows_check():
- text = text.replace('\\', '\\\\')
+ text = text.replace('\\', '\\\\')
return shlex.split(text)
def create_parser(self):