apputil

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Unlicense Imports: 3 Imported by: 0

Documentation

Overview

Package apputil provides utility functions for file and directory operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(fileName string) (merr error)

EnsureDir checks if a file could be written to a path and creates the necessary directories if they don't exist. It ensures that all parent directories in the path are created with the appropriate permissions.

Parameters

  • fileName: The full path to the file for which directories need to be created.

Expected behavior:

  • Extracts the directory path from the fileName.

  • Checks if the directory exists.

  • If the directory doesn't exist, creates it and all parent directories.

func FileExists

func FileExists(filePath string) bool

FileExists reports whether the named file or directory exists.

Parameters

  • filePath: The full path to the file or directory to check.

Returns:

  • bool: true if the file or directory exists, false otherwise.

Behavior:

  • Uses os.Stat to check if the file or directory exists.

  • Returns true if the file exists and can be accessed.

  • Returns false if the file doesn't exist or cannot be accessed due to permissions.

Types

This section is empty.

Source Files

  • apputil.go

Jump to

Keyboard shortcuts

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