ad_get_true_file_path

one of the documented procedures in this installation of the ACS
Usage:
ad_get_true_file_path   path
What it does:
Given a path in the filesystem, returns the file that would be served, trying all possible extensions. Returns an empty string if there's no file "$path.*" in the filesystem (even if the file $path itself does exist).
Defined in: /web/philip/packages/acs-core/abstract-url-procs.tcl

Source code:


    # Sub out funky characters in the pathname, so the user can't request
    # http://www.arsdigita.com/*/index (causing a potentially expensive glob
    # and bypassing registered procedures)!
    regsub -all {[^0-9a-zA-Z_/.]} $path {\\&} path_glob

    # Grab a list of all available files with extensions.
    set files [glob -nocomplain "$path_glob.*"]
    
    # Search for files in the order specified in ExtensionPrecedence.
    set precedence [ad_parameter "ExtensionPrecedence" "abstract-url" "tcl"]
    foreach extension [split [string trim $precedence] ","] {
	if { [lsearch $files "$path.$extension"] != -1 } {
	    return "$path.$extension"
	}
    }

    # None of the extensions from ExtensionPrecedence were found - just pick
    # the first in alphabetical order.
    if { [llength $files] > 0 } {
	set files [lsort $files]
	return [lindex $files 0]
    }

    # Nada!
    return ""


philg@mit.edu