util_current_directory

one of the documented procedures in this installation of the ACS
Usage:
util_current_directory {}
What it does:
Returns the directory of the current URL.

We can't just use [file dirname [ns_conn url]] because we want /foo/bar/ to return /foo/bar/ and not /foo .

Also, we want to return directory WITH the trailing slash so that programs that use this proc don't have to treat the root directory as a special case.

Defined in: /web/philip/packages/acs-core/utilities-procs.tcl

Source code:

arg_parser_for_util_current_directory $args

   set path [ns_conn url]

   set lastchar [string range $path [expr [string length $path]-1] end]
   if {![string compare $lastchar /]} {
        return $path
   } else { 
        set file_dirname [file dirname $path]
        # Treat the case of the root directory special
        if {![string compare $file_dirname /]} {
            return /
        } else {
            return  $file_dirname/
        }
   }


philg@mit.edu