From: Ira W. Snyder Date: Tue, 26 Dec 2006 23:52:57 +0000 (-0800) Subject: [CONFIG] Automatically absolute-ize directories X-Git-Tag: v2.0.0~51 X-Git-Url: https://www.irasnyder.com/gitweb/?a=commitdiff_plain;h=483c0746bc5d2ab17f88ad0a75b9e1c8e175d04d;p=rarslave2.git [CONFIG] Automatically absolute-ize directories This patch makes the RarslaveConfig class automatically return the absolute paths to directories, even though they are not stored in the config that way. Signed-off-by: Ira W. Snyder --- diff --git a/RarslaveConfig.py b/RarslaveConfig.py index 527d976..f4a2988 100644 --- a/RarslaveConfig.py +++ b/RarslaveConfig.py @@ -100,12 +100,16 @@ class RarslaveConfig (object): # into the code, so DON'T DO IT value = self.__get_default_val(section, key) - # Convert config options to booleans for easier use + # Convert config options to native types for easier use SAFE_EVAL = ['None', 'True', 'False', '-1', '0', '1', '2'] if value in SAFE_EVAL: value = eval (value) + # Absolute-ize directories for easier use + if section == 'directories': + value = os.path.abspath (os.path.expanduser (value)) + return value def __init__(self):