file_utils

package
v0.0.0-...-36266b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTruncateFile

func CreateTruncateFile(filePath string) (os.File, error)

CreateTruncateFile receives a filepath and creates a file if it doesn't exist.

func ExistingFilesSet

func ExistingFilesSet(
	inputPath string,
	fiterFileExtension string,
) (map[string]struct{}, error)

ExistingFilesSet creates a set of existing files in a directory.

func GetOrCreateDirectory

func GetOrCreateDirectory(pathToMapsDirectory string) error

GetOrCreateDirectory receives the path to the maps directory and creates it if it doesn't exist.

func ListFiles

func ListFiles(
	inputPath string,
	filterFileExtension string,
) ([]string, error)

ListFiles creates a slice of filepaths from a give input directory based filtering supplied fileExtension

func ReadOrCreateFile

func ReadOrCreateFile(filepath string) (os.File, []byte, error)

ReadOrCreateFile receives a filepath, creates a file if it doesn't exist. Otherwise it reads the file and returns the file and its contents.

func SaveReplayJSONFileToDrive

func SaveReplayJSONFileToDrive(
	replayString string,
	replayFile string,
	absolutePathOutputDirectory string) bool

SaveReplayJSONFileToDrive is a helper function that takes the json string of a StarCraft II replay and writes it to drive.

func UnmarshalJSONMapping

func UnmarshalJSONMapping(
	pathToMappingFile string,
) (map[string]any, error)

UnmarshalJSONMapping wraps around unmarshalLocaleFile and returns an empty map[string]any if it fails to unmarshal the original locale mapping file.

func UnmarshalJsonFile

func UnmarshalJsonFile(
	filepath string,
	mapToPopulate *map[string]any,
) error

UnmarshalJsonFile deals with every possible opening and unmarshalling problem that might occur when unmarshalling a localization file supplied by: https://github.com/Kaszanas/SC2MapLocaleExtractor

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL