mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
improve gsession for file storing
This commit is contained in:
@ -50,14 +50,17 @@ func NewStorageFile(ttl time.Duration, path ...string) *StorageFile {
|
||||
if len(path) > 0 && path[0] != "" {
|
||||
storagePath, _ = gfile.Search(path[0])
|
||||
if storagePath == "" {
|
||||
if err := gfile.Mkdir(storagePath); err != nil {
|
||||
glog.Panicf("mkdir '%s' failed: %v", path[0], err)
|
||||
}
|
||||
glog.Panicf("'%s' does not exist", path[0])
|
||||
}
|
||||
if !gfile.IsWritable(storagePath) {
|
||||
glog.Panicf("'%s' is not writable", path[0])
|
||||
}
|
||||
}
|
||||
if storagePath != "" {
|
||||
if err := gfile.Mkdir(storagePath); err != nil {
|
||||
glog.Panicf("mkdir '%s' failed: %v", path[0], err)
|
||||
}
|
||||
}
|
||||
s := &StorageFile{
|
||||
ttl: ttl,
|
||||
path: storagePath,
|
||||
|
||||
Reference in New Issue
Block a user