filelib

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: MIT Imports: 9 Imported by: 52

README

filelib

license

Go (golang) miscellaneous file and templating routines

Documentation

Overview

Copyright (C) Philip Schlump, 2013-2016. Version: 1.0.3 Tested on Mon Jun 20 18:01:48 MDT 2016

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFiles added in v1.0.3

func AllFiles(path, match string) (fns, dirs []string)

func ApplyFilenames added in v1.0.2

func ApplyFilenames(dir string, fx ApplyFilenamesFunc) (filenames, dirs []string)

func CleanupOldFiles added in v1.0.2

func CleanupOldFiles(dir string, dt time.Duration)

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func ExistsIsDir added in v1.0.2

func ExistsIsDir(name string) bool

ExistsIsDir returns true if the directory exists.

func FilterArray added in v1.0.3

func FilterArray(re string, inArr []string) (outArr []string)

func Fopen

func Fopen(fn string, mode string) (file *os.File, err error)

Fopen opens a file with a mode string - similar to C fopen

func GetFilenames added in v1.0.1

func GetFilenames(dir string) (filenames, dirs []string)

GetFilenames gets a list of file names and directorys.

func InArray added in v1.0.3

func InArray(lookFor string, inArr []string) bool

InArray returns true if `lookFor` is found in `inArr`.

func InArrayN added in v1.0.3

func InArrayN(lookFor string, inArr []string) int

InArrayN returns the position if `lookFor` is found in `inArr`, else -1.

func Qt

func Qt(format string, data map[string]string) string

Qt is a string quick template. %{name%} gets replace with substitution from map if it is in map, else ""

func QtR

func QtR(format string, data map[string]interface{}) string

QtR is a string quick template. It uses the same format as Qt but you get to pass a map[string]interface{}

func RmExt

func RmExt(filename string) string

RmExt remove the extension from a file name and returns the name.

func SearchPathApp

func SearchPathApp(rawFileName string, appName string, searchPath string) (fullFileName string, ok bool)

SearchPathApp searches a set of paths for a particular file.

func SubstitueUserInFilePath

func SubstitueUserInFilePath(s string, mdata map[string]string) (rs string, has bool)

SubstitueUserInFilePath looks up the user and replaces '~' or '~name' whith the home direcotry

Types

type ApplyFilenamesFunc added in v1.0.2

type ApplyFilenamesFunc func(ty string, fn string, fstat os.FileInfo)

Jump to

Keyboard shortcuts

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