1 //
2 // Copyright (c) 2007, Brian Frank and Andy Frank
3 // Licensed under the Academic Free License version 3.0
4 //
5 // History:
6 // 5 May 07 Brian Frank Creation
7 //
8
9 using compiler
10 using fandoc
11
12 **
13 ** CopyResources copies master resource files like fandoc.css
14 ** to the target directory.
15 **
16 class CopyResources : DocCompilerSupport
17 {
18
19 new make(DocCompiler compiler)
20 : super(compiler)
21 {
22 }
23
24 Void run()
25 {
26 copy(`/res/reset.css`, compiler.outDir)
27 copy(`/res/fandev.css`, compiler.outDir)
28 copy(`/res/doc.css`, compiler.outDir)
29 copy(`/res/doc.js`, compiler.outDir)
30 copy(`/res/logo.png`, compiler.outDir)
31 }
32
33 Void copy(Uri uri, File dir)
34 {
35 from := type.pod.files[uri]
36 to := dir + uri.name.toUri
37 if (from == null)
38 {
39 log.warn("Missing resource file $uri")
40 return
41 }
42
43 log.debug(" Copy [$to]")
44
45 to.create
46 out := to.out
47 from.in.pipe(out)
48 out.close
49 }
50
51 }