util_current_directory {}What it does:
Returns the directory of the current URL.Defined in: /web/philip/packages/acs-core/utilities-procs.tclWe 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.
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/ } }