Give error when datadir in appdir

This commit is contained in:
Ruud
2012-06-30 19:03:53 +02:00
parent 89d3b9b72a
commit 0fc5c42aba
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -43,6 +43,7 @@ class Core(Plugin):
addEvent('app.base_url', self.createBaseUrl)
addEvent('app.api_url', self.createApiUrl)
addEvent('app.version', self.version)
addEvent('app.load', self.checkDataDir)
addEvent('setting.save.core.password', self.md5Password)
addEvent('setting.save.core.api_key', self.checkApikey)
@@ -54,6 +55,12 @@ class Core(Plugin):
def checkApikey(self, value):
return value if value and len(value) > 3 else uuid4().hex
def checkDataDir(self):
if Env.get('app_dir') in Env.get('data_dir'):
log.error('You should NOT use your CouchPotato directory to save your settings in. Files will get overwritten or be deleted.')
return True
def available(self):
return jsonified({
'succes': True
+7
View File
@@ -305,6 +305,13 @@ class SourceUpdater(BaseUpdater):
except Exception, e:
log.error('Failed overwriting file: %s', e)
if Env.get('app_dir') not in Env.get('data_dir'):
for still_exists in existing_files:
try:
os.remove(still_exists)
except:
log.error('Failed removing non-used file: %s', traceback.format_exc())
def removeDir(self, path):
try: