initial commit for file_share plugin
This commit is contained in:
26
file_sharing/config.py
Normal file
26
file_sharing/config.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import ConfigParser
|
||||
import sys
|
||||
import os
|
||||
|
||||
def set(option, value):
|
||||
_file = open(path, 'w')
|
||||
cp.set('General', option, value)
|
||||
cp.write(_file)
|
||||
_file.close()
|
||||
|
||||
def set_defaults():
|
||||
cp.add_section('General')
|
||||
set('incoming_dir', '/home')
|
||||
|
||||
path = sys.path[1]
|
||||
path = path + '/file_sharing/' + 'conf.cfg'
|
||||
cp = ConfigParser.ConfigParser()
|
||||
if os.path.exists(path):
|
||||
_file = open(path)
|
||||
cp.readfp(_file)
|
||||
_file.close()
|
||||
else:
|
||||
set_defaults()
|
||||
INCOMING_DIR = cp.get('General', 'incoming_dir')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user