More path encoding

This commit is contained in:
Ruud
2014-05-11 19:36:22 +02:00
parent 311a2798dd
commit b86853f06f
6 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -323,8 +323,8 @@ class SourceUpdater(BaseUpdater):
def replaceWith(self, path):
path = sp(path)
app_dir = ss(Env.get('app_dir'))
data_dir = ss(Env.get('data_dir'))
app_dir = Env.get('app_dir')
data_dir = Env.get('data_dir')
# Get list of files we want to overwrite
self.deletePyc()
+1 -1
View File
@@ -78,7 +78,7 @@ def sp(path, *args):
# Replace *NIX ambiguous '//' at the beginning of a path with '/' (crashes guessit)
path = re.sub('^//', '/', path)
return toUnicode(path)
return path
def ek(original, *args):
+2 -2
View File
@@ -113,7 +113,7 @@ class Plugin(object):
fireEvent('register_%s' % ('script' if ext in 'js' else 'style'), path + os.path.basename(f), f)
def createFile(self, path, content, binary = False):
path = ss(path)
path = sp(path)
self.makeDir(os.path.dirname(path))
@@ -131,7 +131,7 @@ class Plugin(object):
os.remove(path)
def makeDir(self, path):
path = ss(path)
path = sp(path)
try:
if not os.path.isdir(path):
os.makedirs(path, Env.getPermission('folder'))
+2 -2
View File
@@ -7,7 +7,7 @@ from CodernityDB.database import RecordDeleted
from couchpotato import md5, get_db
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import ss, toUnicode
from couchpotato.core.helpers.encoding import ss, toUnicode, sp
from couchpotato.core.helpers.variable import getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
@@ -190,7 +190,7 @@ class Release(Plugin):
for file_type in raw_files:
for release_file in raw_files.get(file_type, []):
if os.path.isfile(ss(release_file)):
if os.path.isfile(sp(release_file)):
if file_type not in files:
files[file_type] = []
files[file_type].append(release_file)
+1 -1
View File
@@ -757,7 +757,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
return False
def moveFile(self, old, dest, forcemove = False):
dest = ss(dest)
dest = sp(dest)
try:
if forcemove or self.conf('file_action') not in ['copy', 'link']:
try:
+1 -1
View File
@@ -151,7 +151,7 @@ class Scanner(Plugin):
try:
files = []
for root, dirs, walk_files in scandir.walk(folder, followlinks=True):
files.extend([sp(os.path.join(root, filename)) for filename in walk_files])
files.extend([sp(os.path.join(sp(root), ss(filename))) for filename in walk_files])
# Break if CP wants to shut down
if self.shuttingDown():