util_current_directory (public)

 util_current_directory

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Returns the directory of the current URL.

We can't just use [file dirname [ad_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.

Partial Call Graph (max 5 caller/called nodes):
%3 ad_returnredirect ad_returnredirect (public) util_current_directory util_current_directory ad_returnredirect->util_current_directory ad_conn ad_conn (public) util_current_directory->ad_conn ad_file ad_file (public) util_current_directory->ad_file

Testcases:
No testcase defined.
Source code:
    set path [ad_conn vhost_url]

    set lastchar [string index $path end]
    if {$lastchar eq "/" } {
        return $path
    } else {
        set file_dirname [ad_file dirname $path]
        # Treat the case of the root directory special
        if {$file_dirname eq "/" } {
            return /
        } else {
            return $file_dirname/
        }
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: