mirror of
https://github.com/depp/syncfiles.git
synced 2024-11-22 03:30:57 +00:00
c96bb9cd0a
This adds support for the simplest 8-bit character encodings, which are compatible with ASCII.
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()
|
|
}
|