mirror of
https://github.com/depp/syncfiles.git
synced 2024-11-22 19:30:49 +00:00
27 lines
487 B
Go
27 lines
487 B
Go
|
package main
|
||
|
|
||
|
import "strconv"
|
||
|
|
||
|
func writeFilenames(charmaps []string, filename string) error {
|
||
|
s, err := createCSource(filename)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
w := s.writer
|
||
|
w.WriteString(header)
|
||
|
w.WriteString(
|
||
|
"#include \"src/test.h\"\n" +
|
||
|
"const char *const kCharsetFilename[] = {\n")
|
||
|
for _, fn := range charmaps {
|
||
|
if fn != "" {
|
||
|
w.WriteByte('\t')
|
||
|
w.WriteString(strconv.Quote(fn))
|
||
|
w.WriteString(",\n")
|
||
|
}
|
||
|
}
|
||
|
w.WriteString("\tNULL\n};\n")
|
||
|
|
||
|
return s.flush()
|
||
|
}
|