GetResource reads a single embedded resource file path is relative to files/ directory (e.g., "tomcat/conf/server.xml")
(path string)
| 17 | // GetResource reads a single embedded resource file |
| 18 | // path is relative to files/ directory (e.g., "tomcat/conf/server.xml") |
| 19 | func GetResource(path string) ([]byte, error) { |
| 20 | fullPath := filepath.Join("files", path) |
| 21 | data, err := EmbeddedResources.ReadFile(fullPath) |
| 22 | if err != nil { |
| 23 | return nil, fmt.Errorf("failed to read embedded resource %s: %w", path, err) |
| 24 | } |
| 25 | return data, nil |
| 26 | } |
| 27 | |
| 28 | // ExtractToDir extracts all embedded resources to the target directory |
| 29 | // Preserves directory structure relative to files/ |
no outgoing calls
no test coverage detected