Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
f6b6d4d6
E
Exa
项目概览
vnotepad
/
Exa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Exa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6b6d4d6
编写于
6月 18, 2014
作者:
B
Ben S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge the two source-file methods
上级
75e8d829
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
25 deletion
+21
-25
file.rs
file.rs
+0
-6
filetype.rs
filetype.rs
+21
-19
未找到文件。
file.rs
浏览文件 @
f6b6d4d6
...
@@ -78,12 +78,6 @@ impl<'a> File<'a> {
...
@@ -78,12 +78,6 @@ impl<'a> File<'a> {
Some
(
"hi"
)
=>
vec!
[
self
.path
.with_extension
(
"hs"
)],
// Haskell
Some
(
"hi"
)
=>
vec!
[
self
.path
.with_extension
(
"hs"
)],
// Haskell
Some
(
"o"
)
=>
vec!
[
self
.path
.with_extension
(
"c"
),
self
.path
.with_extension
(
"cpp"
)],
// C, C++
Some
(
"o"
)
=>
vec!
[
self
.path
.with_extension
(
"c"
),
self
.path
.with_extension
(
"cpp"
)],
// C, C++
Some
(
"pyc"
)
=>
vec!
[
self
.path
.with_extension
(
"py"
)],
// Python
Some
(
"pyc"
)
=>
vec!
[
self
.path
.with_extension
(
"py"
)],
// Python
_
=>
vec!
[],
}
}
pub
fn
get_source_files_usual
(
&
self
)
->
Vec
<
Path
>
{
match
self
.ext
{
Some
(
"js"
)
=>
vec!
[
self
.path
.with_extension
(
"coffee"
),
self
.path
.with_extension
(
"ts"
)],
// CoffeeScript, TypeScript
Some
(
"js"
)
=>
vec!
[
self
.path
.with_extension
(
"coffee"
),
self
.path
.with_extension
(
"ts"
)],
// CoffeeScript, TypeScript
Some
(
"css"
)
=>
vec!
[
self
.path
.with_extension
(
"sass"
),
self
.path
.with_extension
(
"less"
)],
// SASS, Less
Some
(
"css"
)
=>
vec!
[
self
.path
.with_extension
(
"sass"
),
self
.path
.with_extension
(
"less"
)],
// SASS, Less
...
...
filetype.rs
浏览文件 @
f6b6d4d6
...
@@ -15,7 +15,7 @@ static IMAGE_TYPES: &'static [&'static str] = &[
...
@@ -15,7 +15,7 @@ static IMAGE_TYPES: &'static [&'static str] = &[
static
VIDEO_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
static
VIDEO_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
"avi"
,
"flv"
,
"m2v"
,
"mkv"
,
"mov"
,
"mp4"
,
"mpeg"
,
"avi"
,
"flv"
,
"m2v"
,
"mkv"
,
"mov"
,
"mp4"
,
"mpeg"
,
"mpg"
,
"ogm"
,
"ogv"
,
"vob"
,
"wmv"
];
"mpg"
,
"ogm"
,
"ogv"
,
"vob"
,
"wmv"
];
static
MUSIC_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
static
MUSIC_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
"aac"
,
"m4a"
,
"mp3"
,
"ogg"
];
"aac"
,
"m4a"
,
"mp3"
,
"ogg"
];
...
@@ -37,6 +37,9 @@ static TEMP_TYPES: &'static [&'static str] = &[
...
@@ -37,6 +37,9 @@ static TEMP_TYPES: &'static [&'static str] = &[
static
CRYPTO_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
static
CRYPTO_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
"asc"
,
"gpg"
,
"sig"
,
"signature"
,
"pgp"
];
"asc"
,
"gpg"
,
"sig"
,
"signature"
,
"pgp"
];
static
COMPILED_TYPES
:
&
'static
[
&
'static
str
]
=
&
[
"class"
,
"elc"
,
"hi"
,
"o"
,
"pyc"
];
impl
FileType
{
impl
FileType
{
pub
fn
style
(
&
self
)
->
Style
{
pub
fn
style
(
&
self
)
->
Style
{
match
*
self
{
match
*
self
{
...
@@ -69,6 +72,9 @@ impl<'a> HasType for File<'a> {
...
@@ -69,6 +72,9 @@ impl<'a> HasType for File<'a> {
else
if
self
.stat.perm
.contains
(
io
::
UserExecute
)
{
else
if
self
.stat.perm
.contains
(
io
::
UserExecute
)
{
return
Executable
;
return
Executable
;
}
}
else
if
self
.name
.starts_with
(
"README"
)
{
return
Immediate
;
}
else
if
self
.ext
.is_some
()
{
else
if
self
.ext
.is_some
()
{
let
ext
=
self
.ext
.unwrap
();
let
ext
=
self
.ext
.unwrap
();
if
IMAGE_TYPES
.iter
()
.any
(|
&
s
|
s
==
ext
)
{
if
IMAGE_TYPES
.iter
()
.any
(|
&
s
|
s
==
ext
)
{
...
@@ -95,28 +101,24 @@ impl<'a> HasType for File<'a> {
...
@@ -95,28 +101,24 @@ impl<'a> HasType for File<'a> {
else
if
self
.is_tmpfile
()
||
TEMP_TYPES
.iter
()
.any
(|
&
s
|
s
==
ext
)
{
else
if
self
.is_tmpfile
()
||
TEMP_TYPES
.iter
()
.any
(|
&
s
|
s
==
ext
)
{
return
Temp
;
return
Temp
;
}
}
}
let
source_files
=
self
.get_source_files
();
if
self
.name
.starts_with
(
"README"
)
{
if
source_files
.len
()
==
0
{
return
Immediate
;
return
Normal
;
}
}
else
if
source_files
.iter
()
.any
(|
path
|
self
.dir
.contains
(
path
))
{
let
source_files
=
self
.get_source_files
();
return
Temp
;
if
source_files
.len
()
==
0
{
let
source_files_usual
=
self
.get_source_files_usual
();
if
source_files_usual
.iter
()
.any
(|
path
|
self
.dir
.contains
(
path
))
{
Temp
}
}
else
{
else
{
Normal
if
COMPILED_TYPES
.iter
()
.any
(|
&
s
|
s
==
ext
)
{
return
Compiled
;
}
else
{
return
Normal
;
}
}
}
}
}
else
if
source_files
.iter
()
.any
(|
path
|
self
.dir
.contains
(
path
))
{
return
Normal
;
// no filetype
Temp
}
else
{
Compiled
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录