1
0
mirror of https://github.com/JustKato/FreePad.git synced 2026-02-23 15:50:46 +02:00

+ Added some comments

This commit is contained in:
2022-06-01 11:32:12 +03:00
parent 0bc4942924
commit 23dd69e060

View File

@@ -16,6 +16,7 @@ type Post struct {
Content string `json:"content"` Content string `json:"content"`
} }
// Get the path to the storage directory
func getStorageDirectory() string { func getStorageDirectory() string {
baseStoragePath, exists := os.LookupEnv("PAD_STORAGE_PATH") baseStoragePath, exists := os.LookupEnv("PAD_STORAGE_PATH")
@@ -38,6 +39,7 @@ func getStorageDirectory() string {
return baseStoragePath return baseStoragePath
} }
// Get a post from the file system
func GetPost(fileName string) Post { func GetPost(fileName string) Post {
// Get the base storage directory and make sure it exists // Get the base storage directory and make sure it exists
storageDir := getStorageDirectory() storageDir := getStorageDirectory()
@@ -74,6 +76,7 @@ func GetPost(fileName string) Post {
return p return p
} }
// Write a post to the file system
func WritePost(p Post) error { func WritePost(p Post) error {
maximumPadSize := helper.GetMaximumPadSize() maximumPadSize := helper.GetMaximumPadSize()
@@ -105,6 +108,7 @@ func WritePost(p Post) error {
return nil return nil
} }
// Cleanup all of the older posts based on the environment settings
func CleanupPosts(age int) { func CleanupPosts(age int) {
// Initialize the files buffer // Initialize the files buffer
var files []string var files []string
@@ -155,5 +159,4 @@ func CleanupPosts(age int) {
} }
} }
} }