Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
f7e774ee
Commit
f7e774ee
authored
2 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Fixes for stdlib changes
parent
f37362af
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/delete.zig
+1
-2
1 addition, 2 deletions
src/delete.zig
src/main.zig
+1
-2
1 addition, 2 deletions
src/main.zig
src/scan.zig
+12
-9
12 additions, 9 deletions
src/scan.zig
src/ui.zig
+2
-2
2 additions, 2 deletions
src/ui.zig
with
16 additions
and
15 deletions
src/delete.zig
+
1
−
2
View file @
f7e774ee
...
@@ -45,8 +45,7 @@ fn deleteItem(dir: std.fs.Dir, path: [:0]const u8, ptr: *align(1) ?*model.Entry)
...
@@ -45,8 +45,7 @@ fn deleteItem(dir: std.fs.Dir, path: [:0]const u8, ptr: *align(1) ?*model.Entry)
return
true
;
return
true
;
if
(
entry
.
dir
())
|
d
|
{
if
(
entry
.
dir
())
|
d
|
{
var
fd
=
dir
.
openDirZ
(
path
,
.
{
.
access_sub_paths
=
true
,
.
iterate
=
false
})
var
fd
=
dir
.
openDirZ
(
path
,
.
{.
no_follow
=
true
},
false
)
catch
|
e
|
return
err
(
e
);
catch
|
e
|
return
err
(
e
);
var
it
=
&
d
.
sub
;
var
it
=
&
d
.
sub
;
parent
=
d
;
parent
=
d
;
defer
parent
=
parent
.
parent
.?
;
defer
parent
=
parent
.
parent
.?
;
...
...
This diff is collapsed.
Click to expand it.
src/main.zig
+
1
−
2
View file @
f7e774ee
...
@@ -343,8 +343,7 @@ fn spawnShell() void {
...
@@ -343,8 +343,7 @@ fn spawnShell() void {
env
.
put
(
"NCDU_LEVEL"
,
"1"
)
catch
unreachable
;
env
.
put
(
"NCDU_LEVEL"
,
"1"
)
catch
unreachable
;
const
shell
=
std
.
os
.
getenvZ
(
"NCDU_SHELL"
)
orelse
std
.
os
.
getenvZ
(
"SHELL"
)
orelse
"/bin/sh"
;
const
shell
=
std
.
os
.
getenvZ
(
"NCDU_SHELL"
)
orelse
std
.
os
.
getenvZ
(
"SHELL"
)
orelse
"/bin/sh"
;
var
child
=
std
.
ChildProcess
.
init
(
&.
{
shell
},
allocator
)
catch
unreachable
;
var
child
=
std
.
ChildProcess
.
init
(
&.
{
shell
},
allocator
);
defer
child
.
deinit
();
child
.
cwd
=
path
.
items
;
child
.
cwd
=
path
.
items
;
child
.
env_map
=
&
env
;
child
.
env_map
=
&
env
;
...
...
This diff is collapsed.
Click to expand it.
src/scan.zig
+
12
−
9
View file @
f7e774ee
...
@@ -450,8 +450,8 @@ const Context = struct {
...
@@ -450,8 +450,8 @@ const Context = struct {
var
active_context
:
*
Context
=
undefined
;
var
active_context
:
*
Context
=
undefined
;
// Read and index entries of the given dir.
// Read and index entries of the given dir.
fn
scanDir
(
ctx
:
*
Context
,
pat
:
*
const
exclude
.
Patterns
,
dir
:
std
.
fs
.
Dir
,
dir_dev
:
u64
)
void
{
fn
scanDir
(
ctx
:
*
Context
,
pat
:
*
const
exclude
.
Patterns
,
dir
:
std
.
fs
.
Iterable
Dir
,
dir_dev
:
u64
)
void
{
var
it
=
main
.
allocator
.
create
(
std
.
fs
.
Dir
.
Iterator
)
catch
unreachable
;
var
it
=
main
.
allocator
.
create
(
std
.
fs
.
Iterable
Dir
.
Iterator
)
catch
unreachable
;
defer
main
.
allocator
.
destroy
(
it
);
defer
main
.
allocator
.
destroy
(
it
);
it
.*
=
dir
.
iterate
();
it
.*
=
dir
.
iterate
();
while
(
true
)
{
while
(
true
)
{
...
@@ -471,7 +471,7 @@ fn scanDir(ctx: *Context, pat: *const exclude.Patterns, dir: std.fs.Dir, dir_dev
...
@@ -471,7 +471,7 @@ fn scanDir(ctx: *Context, pat: *const exclude.Patterns, dir: std.fs.Dir, dir_dev
continue
;
continue
;
}
}
ctx
.
stat
=
Stat
.
read
(
dir
,
ctx
.
name
,
false
)
catch
{
ctx
.
stat
=
Stat
.
read
(
dir
.
dir
,
ctx
.
name
,
false
)
catch
{
ctx
.
addSpecial
(.
err
);
ctx
.
addSpecial
(.
err
);
continue
;
continue
;
};
};
...
@@ -481,7 +481,7 @@ fn scanDir(ctx: *Context, pat: *const exclude.Patterns, dir: std.fs.Dir, dir_dev
...
@@ -481,7 +481,7 @@ fn scanDir(ctx: *Context, pat: *const exclude.Patterns, dir: std.fs.Dir, dir_dev
}
}
if
(
main
.
config
.
follow_symlinks
and
ctx
.
stat
.
symlink
)
{
if
(
main
.
config
.
follow_symlinks
and
ctx
.
stat
.
symlink
)
{
if
(
Stat
.
read
(
dir
,
ctx
.
name
,
true
))
|
nstat
|
{
if
(
Stat
.
read
(
dir
.
dir
,
ctx
.
name
,
true
))
|
nstat
|
{
if
(
!
nstat
.
dir
)
{
if
(
!
nstat
.
dir
)
{
ctx
.
stat
=
nstat
;
ctx
.
stat
=
nstat
;
// Symlink targets may reside on different filesystems,
// Symlink targets may reside on different filesystems,
...
@@ -497,19 +497,21 @@ fn scanDir(ctx: *Context, pat: *const exclude.Patterns, dir: std.fs.Dir, dir_dev
...
@@ -497,19 +497,21 @@ fn scanDir(ctx: *Context, pat: *const exclude.Patterns, dir: std.fs.Dir, dir_dev
};
};
var
edir
=
var
edir
=
if
(
ctx
.
stat
.
dir
)
dir
.
openDirZ
(
ctx
.
name
,
.
{
.
access_sub_paths
=
true
,
.
iterate
=
true
,
.
no_follow
=
true
})
catch
{
if
(
!
ctx
.
stat
.
dir
)
null
else
if
(
dir
.
dir
.
openDirZ
(
ctx
.
name
,
.
{
.
no_follow
=
true
},
true
))
|
d
|
std
.
fs
.
IterableDir
{.
dir
=
d
}
else
|
_
|
{
ctx
.
addSpecial
(.
err
);
ctx
.
addSpecial
(.
err
);
continue
;
continue
;
}
else
null
;
};
defer
if
(
edir
!=
null
)
edir
.?
.
close
();
defer
if
(
edir
!=
null
)
edir
.?
.
close
();
if
(
@import
(
"builtin"
).
os
.
tag
==
.
linux
and
main
.
config
.
exclude_kernfs
and
ctx
.
stat
.
dir
and
isKernfs
(
edir
.?
,
ctx
.
stat
.
dev
))
{
if
(
@import
(
"builtin"
).
os
.
tag
==
.
linux
and
main
.
config
.
exclude_kernfs
and
ctx
.
stat
.
dir
and
isKernfs
(
edir
.?
.
dir
,
ctx
.
stat
.
dev
))
{
ctx
.
addSpecial
(.
kernfs
);
ctx
.
addSpecial
(.
kernfs
);
continue
;
continue
;
}
}
if
(
main
.
config
.
exclude_caches
and
ctx
.
stat
.
dir
)
{
if
(
main
.
config
.
exclude_caches
and
ctx
.
stat
.
dir
)
{
if
(
edir
.?
.
openFileZ
(
"CACHEDIR.TAG"
,
.
{}))
|
f
|
{
if
(
edir
.?
.
dir
.
openFileZ
(
"CACHEDIR.TAG"
,
.
{}))
|
f
|
{
const
sig
=
"Signature: 8a477f597d28d172789f06886806bc55"
;
const
sig
=
"Signature: 8a477f597d28d172789f06886806bc55"
;
var
buf
:
[
sig
.
len
]
u8
=
undefined
;
var
buf
:
[
sig
.
len
]
u8
=
undefined
;
if
(
f
.
reader
().
readAll
(
&
buf
))
|
len
|
{
if
(
f
.
reader
().
readAll
(
&
buf
))
|
len
|
{
...
@@ -556,13 +558,14 @@ pub fn setupRefresh(parent: *model.Dir) void {
...
@@ -556,13 +558,14 @@ pub fn setupRefresh(parent: *model.Dir) void {
// To be called after setupRefresh() (or from scanRoot())
// To be called after setupRefresh() (or from scanRoot())
pub
fn
scan
()
void
{
pub
fn
scan
()
void
{
defer
active_context
.
deinit
();
defer
active_context
.
deinit
();
var
dir
=
std
.
fs
.
cwd
().
openDirZ
(
active_context
.
pathZ
(),
.
{
.
access_sub_paths
=
true
,
.
iterate
=
true
}
)
catch
|
e
|
{
var
dir
_
=
std
.
fs
.
cwd
().
openDirZ
(
active_context
.
pathZ
(),
.
{
},
true
)
catch
|
e
|
{
active_context
.
last_error
=
main
.
allocator
.
dupeZ
(
u8
,
active_context
.
path
.
items
)
catch
unreachable
;
active_context
.
last_error
=
main
.
allocator
.
dupeZ
(
u8
,
active_context
.
path
.
items
)
catch
unreachable
;
active_context
.
fatal_error
=
e
;
active_context
.
fatal_error
=
e
;
while
(
main
.
state
==
.
refresh
or
main
.
state
==
.
scan
)
while
(
main
.
state
==
.
refresh
or
main
.
state
==
.
scan
)
main
.
handleEvent
(
true
,
true
);
main
.
handleEvent
(
true
,
true
);
return
;
return
;
};
};
var
dir
=
std
.
fs
.
IterableDir
{.
dir
=
dir_
};
defer
dir
.
close
();
defer
dir
.
close
();
var
pat
=
exclude
.
getPatterns
(
active_context
.
pathZ
());
var
pat
=
exclude
.
getPatterns
(
active_context
.
pathZ
());
defer
pat
.
deinit
();
defer
pat
.
deinit
();
...
...
This diff is collapsed.
Click to expand it.
src/ui.zig
+
2
−
2
View file @
f7e774ee
...
@@ -286,8 +286,8 @@ const styles = [_]StyleDef{
...
@@ -286,8 +286,8 @@ const styles = [_]StyleDef{
};
};
pub
const
Style
=
lbl
:
{
pub
const
Style
=
lbl
:
{
var
fields
:
[
styles
.
len
]
std
.
builtin
.
Type
Info
.
EnumField
=
undefined
;
var
fields
:
[
styles
.
len
]
std
.
builtin
.
Type
.
EnumField
=
undefined
;
var
decls
=
[
_
]
std
.
builtin
.
Type
Info
.
Declaration
{};
var
decls
=
[
_
]
std
.
builtin
.
Type
.
Declaration
{};
inline
for
(
styles
)
|
s
,
i
|
{
inline
for
(
styles
)
|
s
,
i
|
{
fields
[
i
]
=
.
{
fields
[
i
]
=
.
{
.
name
=
s
.
name
,
.
name
=
s
.
name
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment