NAME

Krang::File - find a file needed by Krang, searching addons and core


SYNOPSIS

  # find one file, searching through addons and the core
  $file = pkg('File')->find("/htdocs/images/arrow.png");
  # find all instances of a file
  @files = pkg('File')->find_all("/htdocs/images/arrow.png");
  # find all matches for a file glob
  @files = pkg('File')->find_glob("/htdocs/images/*.png");
  # forget past requests
  pkg('File')->flush_cache();


DESCRIPTION

This module finds files, searching through any installed addons and then in core Krang. This allows addons to override files in Krang without overwriting them.


INTERFACE

$file = Krang::File->find($path)

Returns the first instance of $path in an addon or in Krang's core.

NOTE: despite the name this method will find directories as well. It's up to you to use -f or -d as needed.

@files = Krang::File->find_all($path)

Returns all instances of $path in an addon or in Krang's core.

@files = pkg('File')->find_glob("/htdocs/images/*.png")

Returns all files matching a file glob in an addon or in Krang's core.

Krang::File->flush_cache()

Drop the cache of files found. This is needed if files are deleted or new files are added which may override old requests.