support for newer versions of xcrysden

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9653 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
kokalj 2012-11-22 13:52:48 +00:00
parent 8ef7adf8ba
commit 07adcbab9e
1 changed files with 21 additions and 3 deletions

View File

@ -47,9 +47,27 @@ proc ::pwscf::view::structByXcrysden {guiObj} {
global env
if { ! [info exists env(XCRYSDEN_TOPDIR)] && [auto_execok xcrysden] != "" } {
tk_messageBox -title Notification -type ok -icon info \
-message "To view the structure by xcrysden, the XCRYSDEN_TOPDIR\nenviromental variable has to be defined !!!"
return
#
# new versions of xcrysden does not require XCRYSDEN_TOPDIR anymore;
# check is the application sis installed
set xc [auto_execok xcrysden]
if { $xc != "" } {
set xc_dir [file dirname $xc]
if { ! [file exists $xc_dir/usage] } {
# xcrysden script is installed system wide ... search further ...
foreach line [split [::tclu::readFile $xc] \n] {
if { [string match *XCRYSDEN_TOPDIR=* $line] } {
set xc_dir [regsub XCRYSDEN_TOPDIR= $line {}]
}
}
}
set env(XCRYSDEN_TOPDIR) $xc_dir
} else {
tk_messageBox -title Notification -type ok -icon info \
-message "Seems that xcrysden is not installed !!!"
return
}
}
set moduleObj [$guiObj getSelected moduleObj]