put provides a function to add an entry to compound file by given entry name and raw bytes.
(name string, content []byte)
| 693 | // put provides a function to add an entry to compound file by given entry name |
| 694 | // and raw bytes. |
| 695 | func (c *cfb) put(name string, content []byte) { |
| 696 | path := c.paths[0] |
| 697 | if len(path) <= len(name) && name[:len(path)] == path { |
| 698 | path = name |
| 699 | } else { |
| 700 | if len(path) > 0 && string(path[len(path)-1]) != "/" { |
| 701 | path += "/" |
| 702 | } |
| 703 | path = strings.ReplaceAll(path+name, "//", "/") |
| 704 | } |
| 705 | file := sector{name: path, typeID: 2, content: content, size: len(content)} |
| 706 | c.sectors = append(c.sectors, file) |
| 707 | c.paths = append(c.paths, path) |
| 708 | } |
| 709 | |
| 710 | // compare provides a function to compare object path, each set of sibling |
| 711 | // objects in one level of the containment hierarchy (all child objects under |
no outgoing calls