From 483c0746bc5d2ab17f88ad0a75b9e1c8e175d04d Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Tue, 26 Dec 2006 15:52:57 -0800 Subject: [PATCH] [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 --- RarslaveConfig.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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): -- 2.34.1