MCPcopy Create free account
hub / github.com/celer-pkg/celer / Write

Method Write

configs/platform.go:144–169  ·  view source on GitHub ↗
(platformPath string)

Source from the content-addressed store, hash-verified

142}
143
144func (p *Platform) Write(platformPath string) error {
145 // Create empty platform.
146 p.RootFS = &RootFS{
147 PkgConfigPath: []string{},
148 IncludeDirs: []string{},
149 LibDirs: []string{},
150 }
151 p.Toolchain = &Toolchain{}
152
153 bytes, err := toml.Marshal(p)
154 if err != nil {
155 return err
156 }
157
158 // Check if conf/celer.toml exists.
159 if fileio.PathExists(platformPath) {
160 return fmt.Errorf("%s is already exists", platformPath)
161 }
162
163 // Make sure the parent directory exists.
164 parentDir := filepath.Dir(platformPath)
165 if err := os.MkdirAll(parentDir, os.ModePerm); err != nil {
166 return err
167 }
168 return os.WriteFile(platformPath, bytes, os.ModePerm)
169}
170
171// setup rootfs and toolchain
172func (p *Platform) Setup() error {

Callers 1

CreatePlatformMethod · 0.95

Calls 3

PathExistsFunction · 0.92
MkdirAllMethod · 0.80
WriteFileMethod · 0.80

Tested by

no test coverage detected