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
764bbd98
Commit
764bbd98
authored
Dec 19, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#390 should use filepath.Dir instead of path.Dir for.
parent
67b9c635
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
file.go
cache/file.go
+6
-6
file.go
logs/file.go
+1
-2
No files found.
cache/file.go
View file @
764bbd98
...
...
@@ -14,7 +14,7 @@ import (
"fmt"
"io"
"os"
"path"
"path
/filepath
"
"reflect"
"strconv"
"time"
...
...
@@ -79,8 +79,8 @@ func (this *FileCache) StartAndGC(config string) error {
}
func
(
this
*
FileCache
)
Init
()
{
app
:=
path
.
Dir
(
os
.
Args
[
0
])
this
.
CachePath
=
path
.
Join
(
app
,
this
.
CachePath
)
app
:=
file
path
.
Dir
(
os
.
Args
[
0
])
this
.
CachePath
=
file
path
.
Join
(
app
,
this
.
CachePath
)
ok
,
err
:=
exists
(
this
.
CachePath
)
if
err
!=
nil
{
// print error
//fmt.Println(err)
...
...
@@ -102,9 +102,9 @@ func (this *FileCache) getCacheFileName(key string) string {
//fmt.Println("md5" , keyMd5);
switch
this
.
DirectoryLevel
{
case
2
:
cachePath
=
path
.
Join
(
cachePath
,
keyMd5
[
0
:
2
],
keyMd5
[
2
:
4
])
cachePath
=
file
path
.
Join
(
cachePath
,
keyMd5
[
0
:
2
],
keyMd5
[
2
:
4
])
case
1
:
cachePath
=
path
.
Join
(
cachePath
,
keyMd5
[
0
:
2
])
cachePath
=
file
path
.
Join
(
cachePath
,
keyMd5
[
0
:
2
])
}
ok
,
err
:=
exists
(
cachePath
)
...
...
@@ -116,7 +116,7 @@ func (this *FileCache) getCacheFileName(key string) string {
//fmt.Println(err);
}
}
return
path
.
Join
(
cachePath
,
fmt
.
Sprintf
(
"%s%s"
,
keyMd5
,
this
.
FileSuffix
))
return
file
path
.
Join
(
cachePath
,
fmt
.
Sprintf
(
"%s%s"
,
keyMd5
,
this
.
FileSuffix
))
}
func
(
this
*
FileCache
)
Get
(
key
string
)
interface
{}
{
...
...
logs/file.go
View file @
764bbd98
...
...
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"log"
"os"
"path"
"path/filepath"
"strings"
"sync"
...
...
@@ -201,7 +200,7 @@ func (w *FileLogWriter) DoRotate() error {
}
func
(
w
*
FileLogWriter
)
deleteOldLog
()
{
dir
:=
path
.
Dir
(
w
.
Filename
)
dir
:=
file
path
.
Dir
(
w
.
Filename
)
filepath
.
Walk
(
dir
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Unix
()
<
(
time
.
Now
()
.
Unix
()
-
60
*
60
*
24
*
w
.
Maxdays
)
{
if
strings
.
HasPrefix
(
filepath
.
Base
(
path
),
filepath
.
Base
(
w
.
Filename
))
{
...
...
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