@@ -11,7 +11,6 @@ import (
1111
1212 "github.com/eliotttak/GoFileEncoder/pkg/communFunctions"
1313
14- "github.com/sqweek/dialog"
1514 "golang.org/x/term"
1615)
1716
@@ -66,12 +65,18 @@ func Decoder() {
6665 var err error
6766
6867 communFunctions .Try (func () error {
69- cryptedFilePath , err = dialog .File ().
70- Filter ("Fichiers binaires encodés (.enc.bin)" , "enc.bin" ).
71- Filter ("Tous les fichiers" , "*" ).
72- Title ("Sélectionner un fichier" ).
73- Load ()
68+ cryptedFilePath , err = communFunctions .SelectFilePath (
69+ "Sélectionner un fichier" ,
70+ communFunctions.SelectFilePathFilters {
71+ {"Fichiers binaires encodés (.enc.bin)" , "enc.bin" },
72+ {"Tous les fichiers" , "*" },
73+ },
74+ "" ,
75+ "" ,
76+ communFunctions .Load ,
77+ )
7478 return err
79+
7580 }, 3 )
7681
7782 fmt .Printf ("Vous avez sélectionné ce fichier : %s.\n \n " , cryptedFilePath )
@@ -96,10 +101,13 @@ func Decoder() {
96101 var originalFilePath string
97102
98103 communFunctions .Try (func () error {
99- originalFilePath , err = dialog .File ().
100- Title ("Sauvegardez un fichier" ).
101- SetStartFile (filepath .Base (originalFileProposition )).
102- Save ()
104+ originalFilePath , err = communFunctions .SelectFilePath (
105+ "Sauvegardez un fichier" ,
106+ communFunctions.SelectFilePathFilters {},
107+ filepath .Base (originalFileProposition ),
108+ "" ,
109+ communFunctions .Save ,
110+ )
103111 return err
104112 }, 3 )
105113
@@ -142,7 +150,7 @@ func Decoder() {
142150 timeAfter = time .Now ()
143151
144152 timeBetween = timeAfter .Sub (timeBefore )
145- fmt .Printf ("Fichier encodé en %s.\n " , communFunctions .FormatDuration (timeBetween ))
153+ fmt .Printf ("Fichier décodé en %s.\n " , communFunctions .FormatDuration (timeBetween ))
146154 return nil
147155 }
148156
0 commit comments