File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,17 @@ func (a *App) PickFolder() string {
257
257
return path
258
258
}
259
259
260
+ func (a * App ) PickTomlFile () string {
261
+ path , err := zenity .SelectFile (zenity.FileFilter {
262
+ Name : ".toml files" ,
263
+ Patterns : []string {"*.toml" },
264
+ })
265
+ if err != nil {
266
+ println ("ERR: File picker failed" )
267
+ }
268
+ return path
269
+ }
270
+
260
271
func (a * App ) ShowPathInExplorer (path string ) error {
261
272
fileInfo , err := os .Stat (path )
262
273
if err != nil {
Original file line number Diff line number Diff line change @@ -68,6 +68,24 @@ function addFolder() {
68
68
});
69
69
}
70
70
71
+ function addFile() {
72
+ App .PickTomlFile ().then ((result ) => {
73
+ if (result ) {
74
+ if (paths .some ((x ) => x .installPath === result )) {
75
+ toast .error (" Path already added" );
76
+ return ;
77
+ }
78
+
79
+ paths .push ({
80
+ installPath: result ,
81
+ repo: null ,
82
+ tagName: null ,
83
+ visible: true ,
84
+ });
85
+ }
86
+ });
87
+ }
88
+
71
89
function confirmAddBotpack() {
72
90
if (! installPath ) {
73
91
toast .error (" Install path cannot be blank" );
@@ -120,14 +138,14 @@ function confirmAddBotpack() {
120
138
<div class =" paths" >
121
139
<div class =" button-row" >
122
140
<button onclick ={addFolder }>Add folder</button >
123
- <button onclick ={alert . bind ( null , " TODO: not implemented yet " ) }>Add File</button >
141
+ <button onclick ={addFile }>Add File</button >
124
142
<button onclick ={openAddBotpackModal }>Add Botpack</button >
125
143
</div >
126
144
127
145
{#each paths as path , i }
128
146
<div class =" path" >
129
- <Switch bind:checked ={path .visible } />
130
147
<pre >{path .repo ? ` ${path .repo } @ ${path .installPath } ` : path .installPath }</pre >
148
+ <div ><Switch bind:checked ={path .visible } /></div >
131
149
<button class ="close" onclick ={() => removePath (i )}>
132
150
<img src ={closeIcon } alt =" X" />
133
151
</button >
@@ -186,6 +204,9 @@ function confirmAddBotpack() {
186
204
gap : 1rem ;
187
205
justify-content : space-between ;
188
206
}
207
+ .path div {
208
+ margin-left : auto ;
209
+ }
189
210
.path pre {
190
211
font-size : 1rem ;
191
212
margin : 0px ;
You can’t perform that action at this time.
0 commit comments