mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-23 15:08:16 +02:00
v0.6.14 : creer le dossier bin a la premiere installation
Sur une machine vierge, le premier lancement du fichier telecharge echouait sur « open C:\ProgramData\jean\bin\jean.exe: The system cannot find the path specified » : appFirstRun creait le dossier de donnees mais pas son sous-dossier bin, cree jusqu'ici par le seul `jean install`. AJEAN demarrait alors depuis le fichier telecharge, sans installation ni raccourcis. MkdirAll deplace dans installSelf, donc valable quel que soit l'appelant. Reproduit puis verifie sur banc d'essai Windows (parcours complet depuis un dossier de donnees inexistant), + test unitaire.
This commit is contained in:
1 parent
0e94f1e9e2
commit
26ce8a9a14
7 files changed
+40
-13
No files matched your search
@@ -100,6 +100,12 @@ func cmdInstall(args []string) error {
|
||||
// installSelf copies the currently running executable into binDir as jean.exe
|
||||
// and returns the destination path. If the running exe already lives there
|
||||
// (re-install), it's a no-op.
|
||||
//
|
||||
// binDir est créé ici, et pas seulement par l'appelant : sur une machine vierge,
|
||||
// le premier lancement passait par appFirstRun, qui ne créait que le dossier de
|
||||
// données et pas son sous-dossier bin. L'utilisateur recevait alors « open
|
||||
// C:\ProgramData\jean\bin\jean.exe: The system cannot find the path specified »
|
||||
// et AJEAN démarrait depuis le fichier téléchargé, sans jamais s'installer.
|
||||
func installSelf(binDir string) (string, error) {
|
||||
src, err := os.Executable()
|
||||
if err != nil {
|
||||
@@ -110,6 +116,9 @@ func installSelf(binDir string) (string, error) {
|
||||
if strings.EqualFold(src, dst) {
|
||||
return dst, nil
|
||||
}
|
||||
if err := os.MkdirAll(binDir, 0o755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
in, err := os.Open(src)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in new issue
Block a user