From 9398ddb1c284e4a5fec09042959cbc3520240568 Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Tue, 20 Jan 2009 15:55:42 +0000 Subject: Fixed detection of moved/symlinked/touched/removed files. --- src/msec/libmsec.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/msec/libmsec.py b/src/msec/libmsec.py index 89af772..46c511d 100755 --- a/src/msec/libmsec.py +++ b/src/msec/libmsec.py @@ -430,15 +430,6 @@ class ConfigFile: except: error('unlink %s: %s' % (self.path, str(sys.exc_value))) self.log.info(_('deleted %s') % (self.path,)) - elif self.is_modified: - content = string.join(self.lines, "\n") - dirname = os.path.dirname(self.path) - if not os.path.exists(dirname): - os.makedirs(dirname) - file = open(self.path, 'w') - file.write(content) - file.close() - self.meta.modified(self.path) elif self.is_touched: if os.path.exists(self.path): try: @@ -477,11 +468,19 @@ class ConfigFile: except: self.log.error('symlink %s %s: %s' % (self.sym_link, self.path, str(sys.exc_value))) self.log.info(_('made symbolic link from %s to %s') % (self.sym_link, self.path)) - - if self.is_moved: + elif self.is_moved: move(self.path, self.path + self.suffix) self.log.info(_('moved file %s to %s') % (self.path, self.path + self.suffix)) self.meta.modified(self.path) + elif self.is_modified: + content = string.join(self.lines, "\n") + dirname = os.path.dirname(self.path) + if not os.path.exists(dirname): + os.makedirs(dirname) + file = open(self.path, 'w') + file.write(content) + file.close() + self.meta.modified(self.path) self.is_touched = 0 self.is_modified = 0 self.is_deleted = 0 -- cgit v1.2.1