2022-10-02 12:19:00 +03:00
|
|
|
package controllers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/user"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/Redume/EveryNasa/api/utils"
|
|
|
|
"github.com/Redume/EveryNasa/functions"
|
2022-10-23 15:26:51 +03:00
|
|
|
"github.com/gofiber/fiber/v2"
|
2022-10-02 12:19:00 +03:00
|
|
|
)
|
|
|
|
|
2022-10-23 15:26:51 +03:00
|
|
|
var CreateLabel = func(c *fiber.Ctx) error {
|
2022-10-02 12:19:00 +03:00
|
|
|
u, err := user.Current()
|
|
|
|
if err != nil {
|
|
|
|
functions.Logger(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
dir, err := os.Getwd()
|
|
|
|
if err != nil {
|
|
|
|
functions.Logger(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
dir = strings.Replace(dir, "\\", "\\\\", -1) + "\\EveryNasa.exe"
|
|
|
|
|
|
|
|
err = functions.CreateLnk(dir, strings.Replace(u.HomeDir, "\\", "\\\\", -1)+"\\Desktop\\EveryNasa.lnk")
|
|
|
|
if err != nil {
|
|
|
|
functions.Logger(err.Error())
|
|
|
|
}
|
|
|
|
|
2022-10-23 15:26:51 +03:00
|
|
|
utils.Respond(c, utils.Message(true, "The shortcut was successfully created"))
|
|
|
|
return nil
|
2022-10-02 12:19:00 +03:00
|
|
|
}
|