Ticket #107 (new enhancement)

Opened 8 months ago

Last modified 6 months ago

Solar_Path_Stack::findAbsolute()

Reported by: moraes Assigned to: pmjones
Priority: trivial Component: code
Keywords: Solar_Path_Stack Cc:

Description

Here's a method that may be useful sometimes in Solar_Path_Stack: it returns the result from the Solar_File::exists(), instead of the "$dir . $file" returned by Solar_Path_Stack::find(). Currently, there's no way to get the absolute path other than extending the class.

    /**
     *
     * Finds a file in the path stack, and returns its absolute path.
     *
     * @param string $file The file to find using the directory stack
     * and the include_path.
     *
     * @return mixed The absolute path to the file, or false if not
     * found using the stack.
     *
     */
    public function findAbsolute($file)
    {
        foreach ($this->_stack as $dir) {
            $spec = Solar_File::exists($dir . $file);
            if ($spec) {
                return $spec;
            }
        }
        return false;
    }
}

Attachments

Change History

11/25/07 07:12:58 changed by moraes

sorry, the priority was wrongly defined. it should be 'minor' or 'trivial'.

11/25/07 08:29:27 changed by pmjones

  • priority changed from security to trivial.

Add/Change #107 (Solar_Path_Stack::findAbsolute())