1<?php
2
3require_once(dirname(__FILE__).'/../../lib/plugins.php');
4require_once(dirname(__FILE__).'/../../lib/project_file.php');
5
6class projects_plugin_media extends MakeRule {
7	/**
8	 * The name of the rule, a human readable string, a unique identifier
9	 */
10	public function name() { return "MediaLibrary"; }
11
12	/**
13	 * whether this rule can make a given target
14	 */
15	public function can_handle($project, $file) {
16      return file_exists(mediaFN($project->name() . ':' . $file->name()));
17	}
18
19	/**
20	 * returns a recipe to link to the media file
21	 */
22	protected function recipe($project, $file) {
23      $name = $file->name();
24      $id = $project->name() . ':' . $name;
25      $media_name = mediaFN($id);
26      if ($media_name)
27		return "ln -s $media_name $name";
28      return NULL;
29	}
30
31}
32
33?>