TABLE OF CONTENTS


::pwtk::wfcdir_query

SYNOPSIS

proc ::pwtk::wfcdir_query {{hard {}}} {

USAGE

   wfcdir_query ?-hard?

PURPOSE

Query the wfcdir directory.

RETURN VALUE

The value of the current wfcdir.

If -hard option is specified and wfcdir is not defined, the routine returns the value of the ESPRESSO_TMPDIR enviromental variable if it is defined or "." (i.e. current directory) otherwise.

N.B. ESPRESSO_TMPDIR is used in favor of the ESPRESSO_WFCDIR enviromental variable because QE does not use the latter.

SOURCE

    input_push
       ::pwtk::pwi::loadDefaults_ 
       set wfcdir [::pwtk::input::namelistGetVarValue CONTROL wfcdir 1]    
    input_pop

    if { $wfcdir == "" } {
        variable QEdir
        if { [info exists QEdir(ESPRESSO_WFCDIR)] && $QEdir(ESPRESSO_WFCDIR) != "" } {
            set wfcdir $QEdir(ESPRESSO_WFCDIR)
        }
    }

    # -hard option
    if { $hard != "" } {
        if { $hard != "-hard" } {
            ::pwtk::error "wrong option \"$hard\", must be -hard" 1
        } elseif { $wfcdir == {} } {
            global env
            if { [info exists env(ESPRESSO_TMPDIR)] } {
                set wfcdir $env(ESPRESSO_TMPDIR)
            } else {
                set wfcdir .
            }
        }
    }

    return $wfcdir
}