Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
烟灰好
edex-ui
提交
40185f87
E
edex-ui
项目概览
烟灰好
/
edex-ui
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
edex-ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
40185f87
编写于
6月 14, 2018
作者:
G
GitSquared
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🏁
Fallback from CWD tracking on Windows
#97
上级
059dada7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
12 deletion
+40
-12
src/classes/filesystem.class.js
src/classes/filesystem.class.js
+30
-9
src/classes/terminal.class.js
src/classes/terminal.class.js
+10
-3
未找到文件。
src/classes/filesystem.class.js
浏览文件 @
40185f87
...
...
@@ -36,7 +36,9 @@ class FilesystemDisplay {
bar
:
document
.
querySelector
(
"
#fs_space_bar > progress
"
)
};
this
.
fsBlock
=
{};
this
.
dirpath
=
""
;
this
.
failed
=
false
;
this
.
_noTracking
=
false
;
this
.
_runNextTick
=
false
;
this
.
_timer
=
setInterval
(()
=>
{
...
...
@@ -53,26 +55,30 @@ class FilesystemDisplay {
<h2 id="fs_disp_error">CANNOT ACCESS CURRENT WORKING DIRECTORY</h2>`
;
};
window
.
term
.
oncwdchange
=
()
=>
{
if
(
window
.
term
.
cwd
)
{
this
.
readFS
();
this
.
watchFS
();
window
.
term
.
oncwdchange
=
(
cwd
)
=>
{
if
(
cwd
)
{
if
(
cwd
.
startsWith
(
"
FALLBACK |--
"
))
{
this
.
readFS
(
cwd
.
slice
(
13
));
this
.
_noTracking
=
true
;
}
else
{
this
.
readFS
(
cwd
);
this
.
watchFS
(
cwd
);
}
}
};
this
.
watchFS
=
()
=>
{
this
.
watchFS
=
(
dir
)
=>
{
if
(
this
.
_fsWatcher
)
{
this
.
_fsWatcher
.
close
();
}
this
.
_fsWatcher
=
fs
.
watch
(
window
.
term
.
cwd
,
()
=>
{
this
.
_fsWatcher
=
fs
.
watch
(
dir
,
()
=>
{
this
.
_runNextTick
=
true
;
});
};
this
.
readFS
=
()
=>
{
this
.
readFS
=
(
dir
)
=>
{
if
(
this
.
failed
===
true
)
return
false
;
let
tcwd
=
window
.
term
.
cwd
;
document
.
getElementById
(
"
fs_disp_title_dir
"
).
innerText
=
tcwd
;
let
tcwd
=
dir
;
fs
.
readdir
(
tcwd
,
(
err
,
content
)
=>
{
if
(
err
!==
null
)
{
this
.
setFailedState
();
...
...
@@ -170,6 +176,7 @@ class FilesystemDisplay {
}
});
this
.
dirpath
=
tcwd
;
this
.
render
();
});
}
...
...
@@ -182,6 +189,12 @@ class FilesystemDisplay {
this
.
render
=
()
=>
{
if
(
this
.
failed
===
true
)
return
false
;
document
.
getElementById
(
"
fs_disp_title_dir
"
).
innerText
=
this
.
dirpath
;
if
(
this
.
_noTracking
)
{
document
.
querySelector
(
"
section#filesystem > h3.title > p:first-of-type
"
).
innerText
=
"
FILESYSTEM - TRACKING FAILED, RUNNING DETACHED FROM TTY
"
;
}
let
filesDOM
=
``
;
this
.
cwd
.
forEach
(
e
=>
{
let
hidden
=
""
;
...
...
@@ -193,6 +206,14 @@ class FilesystemDisplay {
if
(
e
.
type
===
"
dir
"
||
e
.
type
===
"
up
"
)
{
cmd
=
`window.term.writelr('cd
${
e
.
name
}
')`
;
}
if
(
e
.
type
===
"
up
"
&&
this
.
_noTracking
)
{
cmd
=
`window.fsDisp.readFS('
${
path
.
resolve
(
this
.
dirpath
,
'
..
'
)}
')`
;
}
if
(
e
.
type
===
"
dir
"
&&
this
.
_noTracking
)
{
cmd
=
`window.fsDisp.readFS('
${
path
.
resolve
(
this
.
dirpath
,
e
.
name
)}
')`
;
}
if
(
e
.
type
===
"
edex-theme
"
)
{
cmd
=
`window.themeChanger('
${
e
.
name
.
slice
(
0
,
-
5
)}
')`
;
}
...
...
src/classes/terminal.class.js
浏览文件 @
40185f87
...
...
@@ -79,7 +79,11 @@ class Terminal {
switch
(
args
[
0
])
{
case
"
New cwd
"
:
this
.
cwd
=
args
[
1
];
this
.
oncwdchange
();
this
.
oncwdchange
(
this
.
cwd
);
break
;
case
"
Fallback cwd
"
:
this
.
cwd
=
"
FALLBACK |--
"
+
args
[
1
];
this
.
oncwdchange
(
this
.
cwd
);
break
;
default
:
return
;
...
...
@@ -214,7 +218,7 @@ class Terminal {
console
.
log
(
"
Error while tracking TTY working directory:
"
,
e
);
this
.
_disableCWDtracking
=
true
;
if
(
this
.
renderer
)
{
this
.
renderer
.
send
(
"
terminal_channel-
"
+
this
.
port
,
"
New
cwd
"
,
opts
.
cwd
||
process
.
env
.
PWD
);
this
.
renderer
.
send
(
"
terminal_channel-
"
+
this
.
port
,
"
Fallback
cwd
"
,
opts
.
cwd
||
process
.
env
.
PWD
);
}
});
}
...
...
@@ -247,9 +251,12 @@ class Terminal {
switch
(
args
[
0
])
{
case
"
Renderer startup
"
:
this
.
renderer
=
e
.
sender
;
if
(
this
.
_disableCWDtracking
===
false
&&
this
.
tty
.
_cwd
)
{
if
(
!
this
.
_disableCWDtracking
&&
this
.
tty
.
_cwd
)
{
this
.
renderer
.
send
(
"
terminal_channel-
"
+
this
.
port
,
"
New cwd
"
,
this
.
tty
.
_cwd
);
}
if
(
this
.
_disableCWDtracking
)
{
this
.
renderer
.
send
(
"
terminal_channel-
"
+
this
.
port
,
"
Fallback cwd
"
,
opts
.
cwd
||
process
.
env
.
PWD
);
}
break
;
case
"
Resize
"
:
let
cols
=
args
[
1
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录