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
4c1cfc13
Commit
4c1cfc13
authored
Jan 23, 2016
by
coseyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix path issue
parent
57d522a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
config.go
config.go
+10
-1
parser.go
parser.go
+3
-3
No files found.
config.go
View file @
4c1cfc13
...
...
@@ -103,6 +103,8 @@ var (
BConfig
*
Config
// AppConfig is the instance of Config, store the config information from file
AppConfig
*
beegoAppConfig
// AppPath is the absolute path to the app
AppPath
string
// AppConfigPath is the path to the config files
AppConfigPath
string
// AppConfigProvider is the provider for the config, default is ini
...
...
@@ -179,9 +181,16 @@ func init() {
// ParseConfig parsed default config file.
// now only support ini, next will support json.
func
ParseConfig
()
(
err
error
)
{
AppPath
,
_
:=
filepath
.
Abs
(
filepath
.
Dir
(
os
.
Args
[
0
]))
workPath
,
_
:=
os
.
Getwd
()
workPath
,
_
=
filepath
.
Abs
(
workPath
)
if
workPath
!=
AppPath
{
os
.
Chdir
(
AppPath
)
}
if
AppConfigPath
==
""
{
// initialize default configurations
AppPath
,
_
:=
filepath
.
Abs
(
filepath
.
Dir
(
os
.
Args
[
0
]))
AppConfigPath
=
filepath
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
if
!
utils
.
FileExists
(
AppConfigPath
)
{
AppConfig
=
&
beegoAppConfig
{
config
.
NewFakeConfig
()}
...
...
parser.go
View file @
4c1cfc13
...
...
@@ -130,7 +130,7 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
}
func
genRouterCode
()
{
os
.
Mkdir
(
"routers"
,
0755
)
os
.
Mkdir
(
path
.
Join
(
AppPath
,
"routers"
)
,
0755
)
Info
(
"generate router from comments"
)
var
(
globalinfo
string
...
...
@@ -172,7 +172,7 @@ func genRouterCode() {
}
}
if
globalinfo
!=
""
{
f
,
err
:=
os
.
Create
(
path
.
Join
(
"routers"
,
commentFilename
))
f
,
err
:=
os
.
Create
(
path
.
Join
(
AppPath
,
"routers"
,
commentFilename
))
if
err
!=
nil
{
panic
(
err
)
}
...
...
@@ -182,7 +182,7 @@ func genRouterCode() {
}
func
compareFile
(
pkgRealpath
string
)
bool
{
if
!
utils
.
FileExists
(
path
.
Join
(
"routers"
,
commentFilename
))
{
if
!
utils
.
FileExists
(
path
.
Join
(
AppPath
,
"routers"
,
commentFilename
))
{
return
true
}
if
utils
.
FileExists
(
lastupdateFilename
)
{
...
...
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