diff options
author | Christopher Harvey <chris@basementcode.com> | 2010-06-11 21:58:55 -0400 |
---|---|---|
committer | Christopher Harvey <chris@basementcode.com> | 2010-06-11 21:58:55 -0400 |
commit | d29ec651ae555c3bc16daae8484582d2e49a3904 (patch) | |
tree | 1269019e9295029fb786c54fd75c746587834a68 | |
parent | Added ventoo executable, for /usr/bin (diff) | |
download | ventoo-d29ec651ae555c3bc16daae8484582d2e49a3904.tar.gz ventoo-d29ec651ae555c3bc16daae8484582d2e49a3904.tar.bz2 ventoo-d29ec651ae555c3bc16daae8484582d2e49a3904.zip |
fixed getVentooModuleNameFromSysPath...it was being without system paths.
-rw-r--r-- | src/ventoo/augeas_utils.py | 8 | ||||
-rw-r--r-- | src/ventoo/main.py | 10 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/ventoo/augeas_utils.py b/src/ventoo/augeas_utils.py index 6db6551..88c5a20 100644 --- a/src/ventoo/augeas_utils.py +++ b/src/ventoo/augeas_utils.py @@ -54,11 +54,11 @@ def getVentooModuleNameFromAugPath(a, augPath): Use a full system path to get a ventoo module name. """ def getVentooModuleNameFromSysPath(a, sysPath): - #remove the first character '/' if sysPath is absolute or join wont work. - if sysPath[0] == '/': - augQuery = osp.join('augeas/files', sysPath[1:], 'lens/info') + aug_root = a.get("/augeas/root") + if aug_root == '/': + augQuery = osp.join('augeas/files', stripLeadingSlash(sysPath), 'lens/info') else: - augQuery = osp.join('augeas/files', sysPath, 'lens/info') + augQuery = osp.join('augeas/files', stripLeadingSlash(osp.relpath(sysPath, aug_root)), 'lens/info') lensFile = a.get(augQuery) return str.split(osp.split(lensFile)[1], ".")[0] diff --git a/src/ventoo/main.py b/src/ventoo/main.py index 84fe695..af22595 100644 --- a/src/ventoo/main.py +++ b/src/ventoo/main.py @@ -97,7 +97,7 @@ class MainWindow(gtk.Window): model = editWidget.get_model() thisIter = model.get_iter_from_string(path) enabled = model.get_value(thisIter, 0) - aug_root = a.get("/augeas/root") + aug_root = self.a.get("/augeas/root") if not aug_root == '/': augPath = osp.join('files', osp.relpath(self.currentConfigFilePath, aug_root), self.edit_tv.get_label_path(thisIter)) else: @@ -158,7 +158,7 @@ class MainWindow(gtk.Window): model = editWidget.get_model() thisIter = model.get_iter_from_string(path) enabled = model.get_value(thisIter, 0) - aug_root = a.get("/augeas/root") + aug_root = self.a.get("/augeas/root") #given a iter that was edited, and a current file, build the augeas path to the edited value. if not aug_root == "/": augPath = osp.join('files', osp.relpath(self.currentConfigFilePath, aug_root), self.edit_tv.get_label_path(thisIter)) @@ -227,7 +227,7 @@ class MainWindow(gtk.Window): def refreshAugeasFileList(self): #reload the file selection list from augeas internals. self.files_tv.clearFiles() - fileList = augeas_utils.accumulateFiles(a) + fileList = augeas_utils.accumulateFiles(self.a) for f in fileList: self.files_tv.addPath(f) @@ -397,9 +397,7 @@ class MainWindow(gtk.Window): #update the display...and get new module info. #thse path manipulations are sketchy, should make this code clearer. tmp = self.currentConfigFilePath - if sandboxDir != '/': - tmp = osp.relpath(self.currentConfigFilePath, sandboxDir) - self.currentModule = VentooModule.VentooModule(augeas_utils.getVentooModuleNameFromSysPath(a, tmp)) + self.currentModule = VentooModule.VentooModule(augeas_utils.getVentooModuleNameFromSysPath(self.a, osp.join('/', tmp))) self.refreshAugeasEditTree() def hideApplyDiffButton(self): |