Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
51b6e576
Commit
51b6e576
authored
Mar 14, 2017
by
Orivej Desh
Committed by
Han-Wen Nienhuys
Mar 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set file stat mode and time
parent
45cd3924
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
zipfs/zipfs.go
zipfs/zipfs.go
+4
-2
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+11
-0
No files found.
zipfs/zipfs.go
View file @
51b6e576
...
...
@@ -22,9 +22,11 @@ type ZipFile struct {
}
func
(
f
*
ZipFile
)
Stat
(
out
*
fuse
.
Attr
)
{
// TODO - do something intelligent with timestamps.
out
.
Mode
=
fuse
.
S_IFREG
|
0444
out
.
Mode
=
fuse
.
S_IFREG
|
uint32
(
f
.
File
.
Mode
())
out
.
Size
=
uint64
(
f
.
File
.
UncompressedSize
)
out
.
Mtime
=
uint64
(
f
.
File
.
ModTime
()
.
Unix
())
out
.
Atime
=
out
.
Mtime
out
.
Ctime
=
out
.
Mtime
}
func
(
f
*
ZipFile
)
Data
()
[]
byte
{
...
...
zipfs/zipfs_test.go
View file @
51b6e576
...
...
@@ -10,6 +10,7 @@ import (
"path/filepath"
"runtime"
"testing"
"time"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
...
...
@@ -68,6 +69,16 @@ func TestZipFs(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"Stat failed: %v"
,
err
)
}
if
fi
.
Mode
()
!=
0664
{
t
.
Fatalf
(
"File mode 0%o != 0664"
,
fi
.
Mode
())
}
mtime
,
err
:=
time
.
Parse
(
time
.
RFC3339
,
"2011-02-22T12:56:12Z"
)
if
err
!=
nil
{
panic
(
err
)
}
if
!
fi
.
ModTime
()
.
Equal
(
mtime
)
{
t
.
Fatalf
(
"File mtime %v != %v"
,
fi
.
ModTime
(),
mtime
)
}
if
fi
.
IsDir
()
{
t
.
Error
(
"file type"
,
fi
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment