Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4dde2c59
authored
2014-06-30 15:57:36 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix the parser.go lastupdate
1 parent
62e9c890
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
parser.go
parser.go
View file @
4dde2c5
...
...
@@ -165,12 +165,12 @@ func compareFile(pkgRealpath string) bool {
return
true
}
json
.
Unmarshal
(
content
,
&
pkgLastupdate
)
ft
,
err
:=
os
.
Lstat
(
pkgRealpath
)
lastupdate
,
err
:=
getpathTime
(
pkgRealpath
)
if
err
!=
nil
{
return
true
}
if
v
,
ok
:=
pkgLastupdate
[
pkgRealpath
];
ok
{
if
ft
.
ModTime
()
.
UnixNano
()
<=
v
{
if
lastupdate
<=
v
{
return
false
}
}
...
...
@@ -179,14 +179,27 @@ func compareFile(pkgRealpath string) bool {
}
func
savetoFile
(
pkgRealpath
string
)
{
ft
,
err
:=
os
.
Lstat
(
pkgRealpath
)
lastupdate
,
err
:=
getpathTime
(
pkgRealpath
)
if
err
!=
nil
{
return
}
pkgLastupdate
[
pkgRealpath
]
=
ft
.
ModTime
()
.
UnixNano
()
pkgLastupdate
[
pkgRealpath
]
=
lastupdate
d
,
err
:=
json
.
Marshal
(
pkgLastupdate
)
if
err
!=
nil
{
return
}
ioutil
.
WriteFile
(
path
.
Join
(
AppPath
,
lastupdateFilename
),
d
,
os
.
ModePerm
)
}
func
getpathTime
(
pkgRealpath
string
)
(
lastupdate
int64
,
err
error
)
{
fl
,
err
:=
ioutil
.
ReadDir
(
pkgRealpath
)
if
err
!=
nil
{
return
lastupdate
,
err
}
for
_
,
f
:=
range
fl
{
if
lastupdate
<
f
.
ModTime
()
.
UnixNano
()
{
lastupdate
=
f
.
ModTime
()
.
UnixNano
()
}
}
return
lastupdate
,
nil
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment