summaryrefslogtreecommitdiff
path: root/configBackup.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-26 20:02:33 -0500
committerJeff Carr <[email protected]>2025-09-26 20:02:33 -0500
commitf9cb700a6045d8f2c5d3adb87fb6256125576e36 (patch)
treeadcf79ab4e9e2f5596b260bd619a6ad7eca309ba /configBackup.go
parent0951f0c92e0fe32c8e12dc0eec68049d81859076 (diff)
add a simple config proto filev0.0.6
Diffstat (limited to 'configBackup.go')
-rw-r--r--configBackup.go67
1 files changed, 0 insertions, 67 deletions
diff --git a/configBackup.go b/configBackup.go
deleted file mode 100644
index 8d149c9..0000000
--- a/configBackup.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package config
-
-// thank chatgpt for this because why. why write this if you can have it
-// kick this out in 30 seconds
-
-/*
-func (f *Forge) backupConfig() error {
- // make a new dir to backup the files
- srcDir := filepath.Join(f.configDir)
- destDir := filepath.Join(f.configDir, "backup")
- return backupFiles(srcDir, destDir)
-}
-
-func backupFiles(srcDir string, destDir string) error {
- // Create the destination directory
- err := os.MkdirAll(destDir, os.ModePerm)
- if err != nil {
- return errors.New(fmt.Sprintf("Failed to create directory: %v", err))
- }
-
- // Read the contents of the source directory
- entries, err := os.ReadDir(srcDir)
- if err != nil {
- return errors.New(fmt.Sprintf("Failed to read directory: %v", err))
- }
-
- // Iterate over the entries in the source directory
- for _, entry := range entries {
- // Skip directories and files that do not have the .test extension
- if entry.IsDir() {
- continue
- }
-
- // log.Println("backing up file", entry.Name())
- srcPath := filepath.Join(srcDir, entry.Name())
- destPath := filepath.Join(destDir, entry.Name())
-
- // Copy the file
- if err := copyFile(srcPath, destPath); err != nil {
- return errors.New(fmt.Sprintf("Failed to copy file %s: %v", entry.Name(), err))
- }
- }
- return nil
-}
-
-// copyFile copies a file from src to dest
-func copyFile(src, dest string) error {
- srcFile, err := os.Open(src)
- if err != nil {
- return err
- }
- defer srcFile.Close()
-
- now := time.Now()
- timestamp := now.Format("2006.01.02.150405") // bummer. other date doesn't work?
- dest = dest + timestamp
- destFile, err := os.Create(dest)
- if err != nil {
- return err
- }
- defer destFile.Close()
-
- // Copy the content
- _, err = io.Copy(destFile, srcFile)
- return err
-}
-*/