@@ -36,7 +36,9 @@ class FilesystemDisplay {
36
36
bar : document . querySelector ( "#fs_space_bar > progress" )
37
37
} ;
38
38
this . fsBlock = { } ;
39
+ this . dirpath = "" ;
39
40
this . failed = false ;
41
+ this . _noTracking = false ;
40
42
this . _runNextTick = false ;
41
43
42
44
this . _timer = setInterval ( ( ) => {
@@ -53,26 +55,30 @@ class FilesystemDisplay {
53
55
<h2 id="fs_disp_error">CANNOT ACCESS CURRENT WORKING DIRECTORY</h2>` ;
54
56
} ;
55
57
56
- window . term . oncwdchange = ( ) => {
57
- if ( window . term . cwd ) {
58
- this . readFS ( ) ;
59
- this . watchFS ( ) ;
58
+ window . term . oncwdchange = ( cwd ) => {
59
+ if ( cwd ) {
60
+ if ( cwd . startsWith ( "FALLBACK |-- " ) ) {
61
+ this . readFS ( cwd . slice ( 13 ) ) ;
62
+ this . _noTracking = true ;
63
+ } else {
64
+ this . readFS ( cwd ) ;
65
+ this . watchFS ( cwd ) ;
66
+ }
60
67
}
61
68
} ;
62
69
63
- this . watchFS = ( ) => {
70
+ this . watchFS = ( dir ) => {
64
71
if ( this . _fsWatcher ) {
65
72
this . _fsWatcher . close ( ) ;
66
73
}
67
- this . _fsWatcher = fs . watch ( window . term . cwd , ( ) => {
74
+ this . _fsWatcher = fs . watch ( dir , ( ) => {
68
75
this . _runNextTick = true ;
69
76
} ) ;
70
77
} ;
71
78
72
- this . readFS = ( ) => {
79
+ this . readFS = ( dir ) => {
73
80
if ( this . failed === true ) return false ;
74
- let tcwd = window . term . cwd ;
75
- document . getElementById ( "fs_disp_title_dir" ) . innerText = tcwd ;
81
+ let tcwd = dir ;
76
82
fs . readdir ( tcwd , ( err , content ) => {
77
83
if ( err !== null ) {
78
84
this . setFailedState ( ) ;
@@ -170,6 +176,7 @@ class FilesystemDisplay {
170
176
}
171
177
} ) ;
172
178
179
+ this . dirpath = tcwd ;
173
180
this . render ( ) ;
174
181
} ) ;
175
182
}
@@ -182,6 +189,12 @@ class FilesystemDisplay {
182
189
183
190
this . render = ( ) => {
184
191
if ( this . failed === true ) return false ;
192
+
193
+ document . getElementById ( "fs_disp_title_dir" ) . innerText = this . dirpath ;
194
+ if ( this . _noTracking ) {
195
+ document . querySelector ( "section#filesystem > h3.title > p:first-of-type" ) . innerText = "FILESYSTEM - TRACKING FAILED, RUNNING DETACHED FROM TTY" ;
196
+ }
197
+
185
198
let filesDOM = `` ;
186
199
this . cwd . forEach ( e => {
187
200
let hidden = "" ;
@@ -193,6 +206,14 @@ class FilesystemDisplay {
193
206
if ( e . type === "dir" || e . type === "up" ) {
194
207
cmd = `window.term.writelr('cd ${ e . name } ')` ;
195
208
}
209
+
210
+ if ( e . type === "up" && this . _noTracking ) {
211
+ cmd = `window.fsDisp.readFS('${ path . resolve ( this . dirpath , '..' ) } ')` ;
212
+ }
213
+ if ( e . type === "dir" && this . _noTracking ) {
214
+ cmd = `window.fsDisp.readFS('${ path . resolve ( this . dirpath , e . name ) } ')` ;
215
+ }
216
+
196
217
if ( e . type === "edex-theme" ) {
197
218
cmd = `window.themeChanger('${ e . name . slice ( 0 , - 5 ) } ')` ;
198
219
}
0 commit comments