Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
4dde2c59
Commit
4dde2c59
authored
Jun 30, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the parser.go lastupdate
parent
62e9c890
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
parser.go
parser.go
+17
-4
No files found.
parser.go
View file @
4dde2c59
...
...
@@ -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
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