Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
vnotepad
Exa
提交
b3e38254
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,发现更多精彩内容 >>
提交
b3e38254
编写于
11月 04, 2015
作者:
F
Florian Gilcher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace unstable fs_mode by internal constants
上级
679b9e18
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
12 deletion
+45
-12
src/file.rs
src/file.rs
+44
-11
src/main.rs
src/main.rs
+1
-1
未找到文件。
src/file.rs
浏览文件 @
b3e38254
...
...
@@ -4,7 +4,7 @@ use std::ascii::AsciiExt;
use
std
::
env
::
current_dir
;
use
std
::
fs
;
use
std
::
io
;
use
std
::
os
::
unix
;
use
std
::
os
::
unix
::
raw
;
use
std
::
os
::
unix
::
fs
::{
MetadataExt
,
PermissionsExt
};
use
std
::
path
::{
Component
,
Path
,
PathBuf
};
...
...
@@ -15,6 +15,39 @@ use options::TimeType;
use
self
::
fields
as
f
;
// Constant table copied from https://doc.rust-lang.org/src/std/sys/unix/ext/fs.rs.html#11-259
// which is currently unstable and lacks vision for stabilization,
// see https://github.com/rust-lang/rust/issues/27712
const
USER_READ
:
raw
::
mode_t
=
0o400
;
const
USER_WRITE
:
raw
::
mode_t
=
0o200
;
const
USER_EXECUTE
:
raw
::
mode_t
=
0o100
;
#[allow(dead_code)]
const
USER_RWX
:
raw
::
mode_t
=
0o700
;
const
GROUP_READ
:
raw
::
mode_t
=
0o040
;
const
GROUP_WRITE
:
raw
::
mode_t
=
0o020
;
const
GROUP_EXECUTE
:
raw
::
mode_t
=
0o010
;
#[allow(dead_code)]
const
GROUP_RWX
:
raw
::
mode_t
=
0o070
;
const
OTHER_READ
:
raw
::
mode_t
=
0o004
;
const
OTHER_WRITE
:
raw
::
mode_t
=
0o002
;
const
OTHER_EXECUTE
:
raw
::
mode_t
=
0o001
;
#[allow(dead_code)]
const
OTHER_RWX
:
raw
::
mode_t
=
0o007
;
#[allow(dead_code)]
const
ALL_READ
:
raw
::
mode_t
=
0o444
;
#[allow(dead_code)]
const
ALL_WRITE
:
raw
::
mode_t
=
0o222
;
#[allow(dead_code)]
const
ALL_EXECUTE
:
raw
::
mode_t
=
0o111
;
#[allow(dead_code)]
const
ALL_RWX
:
raw
::
mode_t
=
0o777
;
#[allow(dead_code)]
const
SETUID
:
raw
::
mode_t
=
0o4000
;
#[allow(dead_code)]
const
SETGID
:
raw
::
mode_t
=
0o2000
;
#[allow(dead_code)]
const
STICKY_BIT
:
raw
::
mode_t
=
0o1000
;
/// A **File** is a wrapper around one of Rust's Path objects, along with
/// associated data about the file.
...
...
@@ -104,7 +137,7 @@ impl<'dir> File<'dir> {
/// current user. Executable files have different semantics than
/// executable directories, and so should be highlighted differently.
pub
fn
is_executable_file
(
&
self
)
->
bool
{
let
bit
=
unix
::
fs
::
USER_EXECUTE
;
let
bit
=
USER_EXECUTE
;
self
.is_file
()
&&
(
self
.metadata
.permissions
()
.mode
()
&
bit
)
==
bit
}
...
...
@@ -299,15 +332,15 @@ impl<'dir> File<'dir> {
f
::
Permissions
{
file_type
:
self
.type_char
(),
user_read
:
has_bit
(
unix
::
fs
::
USER_READ
),
user_write
:
has_bit
(
unix
::
fs
::
USER_WRITE
),
user_execute
:
has_bit
(
unix
::
fs
::
USER_EXECUTE
),
group_read
:
has_bit
(
unix
::
fs
::
GROUP_READ
),
group_write
:
has_bit
(
unix
::
fs
::
GROUP_WRITE
),
group_execute
:
has_bit
(
unix
::
fs
::
GROUP_EXECUTE
),
other_read
:
has_bit
(
unix
::
fs
::
OTHER_READ
),
other_write
:
has_bit
(
unix
::
fs
::
OTHER_WRITE
),
other_execute
:
has_bit
(
unix
::
fs
::
OTHER_EXECUTE
),
user_read
:
has_bit
(
USER_READ
),
user_write
:
has_bit
(
USER_WRITE
),
user_execute
:
has_bit
(
USER_EXECUTE
),
group_read
:
has_bit
(
GROUP_READ
),
group_write
:
has_bit
(
GROUP_WRITE
),
group_execute
:
has_bit
(
GROUP_EXECUTE
),
other_read
:
has_bit
(
OTHER_READ
),
other_write
:
has_bit
(
OTHER_WRITE
),
other_execute
:
has_bit
(
OTHER_EXECUTE
),
}
}
...
...
src/main.rs
浏览文件 @
b3e38254
#![feature(convert
,
fs_mode
)]
#![feature(convert)]
#![warn(trivial_casts,
trivial_numeric_casts)]
#![warn(unused_extern_crates,
unused_qualifications)]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录