Add a trailing separator for windows drive path

Fixes  #2581, #2526
This commit is contained in:
mano3m committed 2013-12-29 23:25:53 +01:00
1 parent 4a36c3b6a8
commit f08d34b816
3 files changed
+18 -6

No files matched your search

+5
View File
@@ -60,9 +60,14 @@ def sp(path, *args):
path = os.path.normcase(os.path.normpath(ss(path, *args)))
# Remove any trailing path separators
if path != os.path.sep:
path = path.rstrip(os.path.sep)
# Add a trailing separator in case it is a root folder on windows
if len(path) == 2 and path[1] == ':':
path = path + os.path.sep
return path
def ek(original, *args):
+5 -1
View File
@@ -2,7 +2,7 @@ from couchpotato.core.helpers.encoding import simplifyString, toSafeString, ss
from couchpotato.core.logger import CPLog
import collections
import hashlib
import os.path
import os
import platform
import random
import re
@@ -219,3 +219,7 @@ def splitString(str, split_on = ',', clean = True):
def dictIsSubset(a, b):
return all([k in b and b[k] == v for k, v in a.items()])
def isSubFolder(sub_folder, base_folder):
# Returns True is sub_folder is the same as or in base_folder
return base_folder.rstrip(os.path.sep) + os.path.sep in sub_folder.rstrip(os.path.sep) + os.path.sep