MCPcopy Create free account
hub / github.com/blues/note / fsFilename

Function fsFilename

lib/file.go:114–132  ·  view source on GitHub ↗

Generate a filename given some hints that are used to 'weigh in' on the aesthetics

(storageHint string, filenameHint string)

Source from the content-addressed store, hash-verified

112
113// Generate a filename given some hints that are used to 'weigh in' on the aesthetics
114func fsFilename(storageHint string, filenameHint string) string {
115 // If no filename is specified, default it
116 if filenameHint == "" {
117 filenameHint = defaultFileStorageName
118 }
119
120 // Generate the filename
121 cleanFilename := FileCleanName(filenameHint)
122
123 // If storage is specified (such as a Notebox), get the folder hint from storage. Note
124 // that if it's the file system, we know that we need to clean it because of the colons, but
125 // otherwise, let it pass through.
126 if storageHint != "" {
127 return fio.CleanName(storageHint) + "/" + cleanFilename
128 }
129
130 // Return just the clean filename
131 return cleanFilename
132}
133
134// Combine two components into a filename
135func fsConstruct(storage string, filename string) string {

Callers 2

createMethod · 0.85
FileStorageObjectFunction · 0.85

Calls 2

FileCleanNameFunction · 0.85
CleanNameMethod · 0.65

Tested by

no test coverage detected