mirror of
https://github.com/Starlio-app/StarlioX
synced 2025-02-22 23:13:12 +03:00
Added creation of a shortcut on the desktop
This commit is contained in:
parent
d0496c5fdf
commit
3f51438c24
3 changed files with 107 additions and 0 deletions
32
api/controllers/label.go
Normal file
32
api/controllers/label.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
"strings"
|
||||
|
||||
"github.com/Redume/EveryNasa/api/utils"
|
||||
"github.com/Redume/EveryNasa/functions"
|
||||
)
|
||||
|
||||
var CreateLabel = func(w http.ResponseWriter, r *http.Request) {
|
||||
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())
|
||||
}
|
||||
|
||||
utils.Respond(w, utils.Message(true, "The shortcut was successfully created"))
|
||||
}
|
Loading…
Add table
Reference in a new issue