]>
Commit | Line | Data |
---|---|---|
60f06724 AF |
1 | --- mpd_sima_0.8.0/src/utils/startopt.py.wiget 2012-02-03 14:09:03.722512780 +0100 |
2 | +++ mpd_sima_0.8.0/src/utils/startopt.py 2012-02-03 14:10:09.119982354 +0100 | |
3 | @@ -52,6 +52,13 @@ def is_file_exist(option, opt_str, value | |
4 | raise OptionValueError('no access to "%s"' % value) | |
5 | setattr(parser.values, option.dest, value) | |
6 | ||
7 | +def is_directory_rwable(option, opt_str, value, parser): | |
8 | + value = normalize_path(value) | |
9 | + # Check either file is write-able or not | |
10 | + if not access(value, W_OK): | |
11 | + raise OptionValueError('no write access to "%s"' % value) | |
12 | + setattr(parser.values, option.dest, value) | |
13 | + | |
14 | def obsolete_option(option, opt_str, value, parser): | |
15 | raise parser.error('"%s" now obsolete' % option)#}}} | |
16 | ||
17 | @@ -129,7 +136,7 @@ OPTS = list([ | |
18 | 'type': 'string', | |
19 | 'dest': 'var_dir', | |
20 | 'action': 'callback', | |
21 | - 'callback': is_file_rwable, | |
22 | + 'callback': is_directory_rwable, | |
23 | 'help': 'Directory to store var content (ie. database)'}, | |
24 | { | |
25 | 'sw': ['--new-version'], |