MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / WriteFileIfDifferent

Function WriteFileIfDifferent

pkg/util/utilfn/utilfn.go:903–913  ·  view source on GitHub ↗
(fileName string, contents []byte)

Source from the content-addressed store, hash-verified

901}
902
903func WriteFileIfDifferent(fileName string, contents []byte) (bool, error) {
904 oldContents, err := os.ReadFile(fileName)
905 if err == nil && bytes.Equal(oldContents, contents) {
906 return false, nil
907 }
908 err = os.WriteFile(fileName, contents, 0644)
909 if err != nil {
910 return false, err
911 }
912 return true, nil
913}
914
915func GetLineColFromOffset(barr []byte, offset int) (int, int) {
916 line := 1

Callers 9

generateTypesFileFunction · 0.92
generateWaveEventFileFunction · 0.92
generateServicesFileFunction · 0.92
generateWshClientApiFileFunction · 0.92
generateSchemaFunction · 0.92
generateWidgetsSchemaFunction · 0.92
GenerateWshClientFunction · 0.92

Calls 2

ReadFileMethod · 0.80
WriteFileMethod · 0.80

Tested by

no test coverage detected