Infer absolute path with drive letter on Windows

This commit is contained in:
Ole André Vadla Ravnås
2015-02-23 00:05:08 +01:00
parent 24b45d6d54
commit 4a57344ddc
+6 -1
View File
@@ -3,6 +3,7 @@
import collections
from optparse import OptionParser
import os
import platform
import sys
import threading
import time
@@ -180,7 +181,11 @@ def find_device(type):
return None
def infer_target(target_value):
if target_value.startswith('.') or target_value.startswith(os.path.sep):
if target_value.startswith('.') or target_value.startswith(os.path.sep) \
or (platform.system() == 'Windows' \
and target_value[0].isalpha() \
and target_value[1] == ":" \
and target_value[2] == "\\"):
target_type = 'file'
target_value = [target_value]
else: