Skip to content

Commit

Permalink
making os.chdir happen a little sooner in the process
Browse files Browse the repository at this point in the history
cleaning web interface to show proper saved path to ini file
  • Loading branch information
travisghansen committed Mar 27, 2011
1 parent bc3837b commit adcafec
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions SickBeard.py
Expand Up @@ -73,7 +73,6 @@ def daemonize():
raise RuntimeError("1st fork failed: %s [%d]" %
(e.strerror, e.errno))

os.chdir(sickbeard.DATA_DIR)
os.setsid()

# Make sure I can read my own files and shut out others
Expand Down Expand Up @@ -194,12 +193,17 @@ def main():
except os.error, e:
raise SystemExit("Unable to create datadir '" + sickbeard.DATA_DIR + "'")

if not os.access(sickbeard.DATA_DIR, os.W_OK):
raise SystemExit("datadir must be writeable '" + sickbeard.DATA_DIR + "'")

os.chdir(sickbeard.DATA_DIR)

if consoleLogging:
print "Starting up Sick Beard "+SICKBEARD_VERSION+" from " + sickbeard.CONFIG_FILE

# load the config and publish it to the sickbeard package
if not os.path.isfile(sickbeard.CONFIG_FILE):
logger.log(u"Unable to find config.ini, all settings will be default", logger.ERROR)
logger.log(u"Unable to find " + sickbeard.CONFIG_FILE + " , all settings will be default", logger.ERROR)

sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)

Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/default/config_general.tmpl
Expand Up @@ -14,7 +14,7 @@

<div id="config">
<div id="config-content">
<h5>All non-absolute folder locations are relative to " <span class="path">$sickbeard.PROG_DIR</span> "</h5>
<h5>All non-absolute folder locations are relative to " <span class="path">$sickbeard.DATA_DIR</span> "</h5>

<form action="saveGeneral" method="post">

Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/default/config_postProcessing.tmpl
Expand Up @@ -16,7 +16,7 @@

<div id="config">
<div id="config-content">
<h5>All non-absolute folder locations are relative to " <span class="path">$sickbeard.PROG_DIR</span> "</h5>
<h5>All non-absolute folder locations are relative to " <span class="path">$sickbeard.DATA_DIR</span> "</h5>

<form action="savePostProcessing" method="post">

Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/default/config_search.tmpl
Expand Up @@ -13,7 +13,7 @@

<div id="config">
<div id="config-content">
<h5>All non-absolute folder locations are relative to " <span class="path">$sickbeard.PROG_DIR</span> "</h5>
<h5>All non-absolute folder locations are relative to " <span class="path">$sickbeard.DATA_DIR</span> "</h5>
<form action="saveSearch" method="post">

<div id="config-components">
Expand Down
10 changes: 5 additions & 5 deletions sickbeard/webserve.py
Expand Up @@ -682,7 +682,7 @@ def saveGeneral(self, log_dir=None, web_port=None, web_log=None, web_ipv6=None,
ui.flash.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.PROG_DIR, 'config.ini') )
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE) )

redirect("/config/general/")

Expand Down Expand Up @@ -763,7 +763,7 @@ def saveSearch(self, use_nzbs=None, use_torrents=None, nzb_dir=None, sab_usernam
ui.flash.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.PROG_DIR, 'config.ini') )
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE) )

redirect("/config/search/")

Expand Down Expand Up @@ -870,7 +870,7 @@ def savePostProcessing(self, season_folders_format=None, naming_show_name=None,
ui.flash.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.PROG_DIR, 'config.ini') )
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE) )

redirect("/config/postProcessing/")

Expand Down Expand Up @@ -1130,7 +1130,7 @@ def saveProviders(self, tvbinz_uid=None, tvbinz_hash=None, nzbs_org_uid=None,
ui.flash.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.PROG_DIR, 'config.ini') )
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE) )

redirect("/config/providers/")

Expand Down Expand Up @@ -1277,7 +1277,7 @@ def saveNotifications(self, use_xbmc=None, xbmc_notify_onsnatch=None, xbmc_notif
ui.flash.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.PROG_DIR, 'config.ini') )
ui.flash.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE) )

redirect("/config/notifications/")

Expand Down

0 comments on commit adcafec

Please sign in to comment.