Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/aya/trunk@84 cec141ff-132a-4243-88a5-ce187bd62f94
28 lines
656 B
Go
28 lines
656 B
Go
// Copy files as-is from source to destination
|
|
// If there are heavy files, the generation process can slow down
|
|
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func buildRaw(path string, w io.Writer) error {
|
|
in, err := os.Open(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer in.Close()
|
|
if w == nil {
|
|
if out, err := os.Create(filepath.Join(PUBDIR, path)); err != nil {
|
|
return err
|
|
} else {
|
|
defer out.Close()
|
|
w = out
|
|
}
|
|
}
|
|
_, err = io.Copy(w, in)
|
|
return err
|
|
}
|