@@ -126,6 +126,78 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
126
126
*/
127
127
_userFolder
128
128
129
+ /**
130
+ * @type {string }
131
+ */
132
+ _homeFolder
133
+ /**
134
+ * @type {string }
135
+ */
136
+ _appDataFolder
137
+ /**
138
+ * @type {string }
139
+ */
140
+ _userDataFolder
141
+ /**
142
+ * @type {string }
143
+ */
144
+ _sessionDataFolder
145
+ /**
146
+ * @type {string }
147
+ */
148
+ _tempFolder
149
+ /**
150
+ * @type {string }
151
+ */
152
+ _exeFolder
153
+ /**
154
+ * @type {string }
155
+ */
156
+ _moduleFolder
157
+ /**
158
+ * @type {string }
159
+ */
160
+ _desktopFolder
161
+ /**
162
+ * @type {string }
163
+ */
164
+ _documentsFolder
165
+ /**
166
+ * @type {string }
167
+ */
168
+ _downloadsFolder
169
+ /**
170
+ * @type {string }
171
+ */
172
+ _musicFolder
173
+ /**
174
+ * @type {string }
175
+ */
176
+ _picturesFolder
177
+ /**
178
+ * @type {string }
179
+ */
180
+ _videosFolder
181
+ /**
182
+ * @type {string }
183
+ */
184
+ _recentFolder
185
+ /**
186
+ * @type {string }
187
+ */
188
+ _logsFolder
189
+ /**
190
+ * @type {string }
191
+ */
192
+ _crashDumpsFolder
193
+ /**
194
+ * @type {string }
195
+ */
196
+ _appFolder
197
+ /**
198
+ * @type {string }
199
+ */
200
+
129
201
/** @type {string } */
130
202
_currentTag
131
203
@@ -231,6 +303,7 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
231
303
reconnectInterval : 5000
232
304
} ) ;
233
305
306
+ // expose websocket instance
234
307
window . pipelab = {
235
308
ws : this . ws
236
309
}
@@ -239,22 +312,50 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
239
312
240
313
console . log ( 'this.ws' , this . ws )
241
314
242
- // -----------------------------------------------------------------------
243
- // Fetch user folder
244
- /** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'input'> } */
245
- const orderUserFolder = {
246
- url : '/paths' ,
247
- body : {
248
- name : 'home'
315
+ const paths = [
316
+ // app.getPath(name)
317
+ [ 'home' , '_homeFolder' ] ,
318
+ [ 'appData' , '_appDataFolder' ] ,
319
+ [ 'userData' , '_userDataFolder' ] ,
320
+ [ 'sessionData' , '_sessionDataFolder' ] ,
321
+ [ 'temp' , '_tempFolder' ] ,
322
+ [ 'exe' , '_exeFolder' ] ,
323
+ [ 'module' , '_moduleFolder' ] ,
324
+ [ 'desktop' , '_desktopFolder' ] ,
325
+ [ 'documents' , '_documentsFolder' ] ,
326
+ [ 'downloads' , '_downloadsFolder' ] ,
327
+ [ 'music' , '_musicFolder' ] ,
328
+ [ 'pictures' , '_picturesFolder' ] ,
329
+ [ 'videos' , '_videosFolder' ] ,
330
+ [ 'recent' , '_recentFolder' ] ,
331
+ [ 'logs' , '_logsFolder' ] ,
332
+ [ 'crashDumps' , '_crashDumpsFolder' ] ,
333
+ // app.getAppPath
334
+ [ 'app' , '_appFolder' ] ,
335
+ ]
336
+
337
+ const promises = paths . map ( async ( name ) => {
338
+
339
+ // -----------------------------------------------------------------------
340
+ // Fetch user folder
341
+ /** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'input'> } */
342
+ const orderPath = {
343
+ url : '/paths' ,
344
+ body : {
345
+ name : name [ 0 ]
346
+ }
249
347
}
250
- }
251
348
252
- /**
253
- * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'output'> }
254
- */
255
- const userFolder = await this . ws . sendAndWaitForResponse ( orderUserFolder )
256
- console . log ( 'userFolder' , userFolder . body . data )
257
- this . _userFolder = userFolder . body . data
349
+ /**
350
+ * @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessagePaths, 'output'> }
351
+ */
352
+ const pathFolder = await this . ws ?. sendAndWaitForResponse ( orderPath )
353
+ console . log ( 'pathFolder' , pathFolder . body . data )
354
+ this [ name [ 1 ] ] = pathFolder . body . data
355
+
356
+ } )
357
+
358
+ await Promise . all ( promises )
258
359
259
360
// -----------------------------------------------------------------------
260
361
// Fetch engine
@@ -617,12 +718,13 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
617
718
throw new Error ( '"_DeleteFile" Not implemented' )
618
719
} , this . unsupportedEngine )
619
720
620
- _ListFiles = this . wrap ( super . _ListFiles , async ( path ) => {
721
+ _ListFiles = this . wrap ( super . _ListFiles , async ( path , recursive ) => {
621
722
/** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageListFiles, 'input'> } */
622
723
const order = {
623
724
url : '/fs/list' ,
624
725
body : {
625
- path
726
+ path,
727
+ recursive,
626
728
}
627
729
}
628
730
const files = await this . ws ?. sendAndWaitForResponse ( order )
@@ -854,6 +956,80 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
854
956
return this . _userFolder ?? ''
855
957
} )
856
958
959
+ _HomeFolder = this . wrap ( super . _HomeFolder , ( ) => {
960
+ console . log ( 'this' , this )
961
+ return this . _homeFolder ?? ''
962
+ } )
963
+ _AppDataFolder = this . wrap ( super . _AppDataFolder , ( ) => {
964
+ console . log ( 'this' , this )
965
+ return this . _appDataFolder ?? ''
966
+ } )
967
+ _UserDataFolder = this . wrap ( super . _UserDataFolder , ( ) => {
968
+ console . log ( 'this' , this )
969
+ return this . _userFolder ?? ''
970
+ } )
971
+ _SessionDataFolder = this . wrap ( super . _SessionDataFolder , ( ) => {
972
+ console . log ( 'this' , this )
973
+ return this . _sessionDataFolder ?? ''
974
+ } )
975
+ _TempFolder = this . wrap ( super . _TempFolder , ( ) => {
976
+ console . log ( 'this' , this )
977
+ return this . _tempFolder ?? ''
978
+ } )
979
+ _ExeFolder = this . wrap ( super . _ExeFolder , ( ) => {
980
+ console . log ( 'this' , this )
981
+ return this . _exeFolder ?? ''
982
+ } )
983
+ _ModuleFolder = this . wrap ( super . _ModuleFolder , ( ) => {
984
+ console . log ( 'this' , this )
985
+ return this . _moduleFolder ?? ''
986
+ } )
987
+ _DesktopFolder = this . wrap ( super . _DesktopFolder , ( ) => {
988
+ console . log ( 'this' , this )
989
+ return this . _desktopFolder ?? ''
990
+ } )
991
+ _DocumentsFolder = this . wrap ( super . _DocumentsFolder , ( ) => {
992
+ console . log ( 'this' , this )
993
+ return this . _documentsFolder ?? ''
994
+ } )
995
+ _DownloadsFolder = this . wrap ( super . _DownloadsFolder , ( ) => {
996
+ console . log ( 'this' , this )
997
+ return this . _downloadsFolder ?? ''
998
+ } )
999
+ _MusicFolder = this . wrap ( super . _MusicFolder , ( ) => {
1000
+ console . log ( 'this' , this )
1001
+ return this . _musicFolder ?? ''
1002
+ } )
1003
+ _PicturesFolder = this . wrap ( super . _PicturesFolder , ( ) => {
1004
+ console . log ( 'this' , this )
1005
+ return this . _picturesFolder ?? ''
1006
+ } )
1007
+ _VideosFolder = this . wrap ( super . _VideosFolder , ( ) => {
1008
+ console . log ( 'this' , this )
1009
+ return this . _videosFolder ?? ''
1010
+ } )
1011
+ _RecentFolder = this . wrap ( super . _RecentFolder , ( ) => {
1012
+ console . log ( 'this' , this )
1013
+ return this . _recentFolder ?? ''
1014
+ } )
1015
+ _LogsFolder = this . wrap ( super . _LogsFolder , ( ) => {
1016
+ console . log ( 'this' , this )
1017
+ return this . _logsFolder ?? ''
1018
+ } )
1019
+ _CrashDumpsFolder = this . wrap ( super . _CrashDumpsFolder , ( ) => {
1020
+ console . log ( 'this' , this )
1021
+ return this . _crashDumpsFolder ?? ''
1022
+ } )
1023
+
1024
+ _AppFolder = this . wrap ( super . _AppFolder , ( ) => {
1025
+ console . log ( 'this' , this )
1026
+ return this . _appFolder ?? ''
1027
+ } )
1028
+
1029
+ _AppFolderURL = this . wrap ( super . _AppFolderURL , ( ) => {
1030
+ return 'deprecrated'
1031
+ } )
1032
+
857
1033
_ArgumentAt = this . wrap ( super . _ArgumentAt , ( ) => {
858
1034
console . error ( '"_ArgumentAt" Not implemented' )
859
1035
return ''
@@ -868,16 +1044,6 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
868
1044
return this . _chosenPath ?? ''
869
1045
} )
870
1046
871
- _AppFolder = this . wrap ( super . _AppFolder , ( ) => {
872
- console . error ( '"_AppFolder" Not implemented' )
873
- return ''
874
- } )
875
-
876
- _AppFolderURL = this . wrap ( super . _AppFolderURL , ( ) => {
877
- console . error ( '"_AppFolderURL" Not implemented' )
878
- return ''
879
- } )
880
-
881
1047
_DroppedFile = this . wrap ( super . _DroppedFile , ( ) => {
882
1048
console . error ( '"_DroppedFile" Not implemented' )
883
1049
return ''
@@ -896,7 +1062,7 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
896
1062
} )
897
1063
898
1064
_ListAt = this . wrap ( super . _ListAt , ( index ) => {
899
- return this . _fileList [ index ] ?. name ?? ''
1065
+ return this . _fileList [ index ] ?. path ?? ''
900
1066
} )
901
1067
902
1068
_ListCount = this . wrap ( super . _ListCount , ( ) => {
0 commit comments