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
7ceff43d
Commit
7ceff43d
authored
May 06, 2016
by
ysqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed error in window os
parent
3c8ed9ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
parser.go
parser.go
+8
-7
No files found.
parser.go
View file @
7ceff43d
...
...
@@ -23,7 +23,6 @@ import (
"go/token"
"io/ioutil"
"os"
"path"
"path/filepath"
"sort"
"strings"
...
...
@@ -58,7 +57,8 @@ func init() {
func
parserPkg
(
pkgRealpath
,
pkgpath
string
)
error
{
rep
:=
strings
.
NewReplacer
(
"
\\
"
,
"_"
,
"/"
,
"_"
,
"."
,
"_"
)
commentFilename
=
coomentPrefix
+
rep
.
Replace
(
strings
.
Replace
(
pkgRealpath
,
AppPath
,
""
,
-
1
))
+
".go"
commentFilename
,
_
=
filepath
.
Rel
(
AppPath
,
pkgRealpath
)
commentFilename
=
coomentPrefix
+
rep
.
Replace
(
commentFilename
)
+
".go"
if
!
compareFile
(
pkgRealpath
)
{
logs
.
Info
(
pkgRealpath
+
" no changed"
)
return
nil
...
...
@@ -174,7 +174,7 @@ func genRouterCode(pkgRealpath string) {
}
}
if
globalinfo
!=
""
{
f
,
err
:=
os
.
Create
(
path
.
Join
(
getRouterDir
(
pkgRealpath
),
commentFilename
))
f
,
err
:=
os
.
Create
(
file
path
.
Join
(
getRouterDir
(
pkgRealpath
),
commentFilename
))
if
err
!=
nil
{
panic
(
err
)
}
...
...
@@ -184,7 +184,7 @@ func genRouterCode(pkgRealpath string) {
}
func
compareFile
(
pkgRealpath
string
)
bool
{
if
!
utils
.
FileExists
(
path
.
Join
(
getRouterDir
(
pkgRealpath
),
commentFilename
))
{
if
!
utils
.
FileExists
(
file
path
.
Join
(
getRouterDir
(
pkgRealpath
),
commentFilename
))
{
return
true
}
if
utils
.
FileExists
(
lastupdateFilename
)
{
...
...
@@ -235,11 +235,12 @@ func getpathTime(pkgRealpath string) (lastupdate int64, err error) {
func
getRouterDir
(
pkgRealpath
string
)
string
{
dir
:=
filepath
.
Dir
(
pkgRealpath
)
for
{
d
:=
path
.
Join
(
dir
,
"routers"
)
if
dir
==
AppPath
{
d
:=
file
path
.
Join
(
dir
,
"routers"
)
if
utils
.
FileExists
(
d
)
{
return
d
}
if
utils
.
FileExists
(
d
)
{
if
r
,
_
:=
filepath
.
Rel
(
dir
,
AppPath
);
r
==
"."
{
return
d
}
// Parent dir.
...
...
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