Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
f5692253
Commit
f5692253
authored
Aug 29, 2020
by
Ink-33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加载配置失败后备份源配置文件
配置结构升级不备份,我配置没了
parent
9c65ff4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
global/config.go
global/config.go
+4
-0
No files found.
global/config.go
View file @
f5692253
...
...
@@ -2,6 +2,8 @@ package global
import
(
"encoding/json"
"os"
"strconv"
"time"
log
"github.com/sirupsen/logrus"
...
...
@@ -117,6 +119,8 @@ func Load(p string) *JsonConfig {
err
:=
json
.
Unmarshal
([]
byte
(
ReadAllText
(
p
)),
&
c
)
if
err
!=
nil
{
log
.
Warnf
(
"尝试加载配置文件 %v 时出现错误: %v"
,
p
,
err
)
log
.
Infoln
(
"原文件已备份"
)
os
.
Rename
(
p
,
p
+
".backup"
+
strconv
.
FormatInt
(
time
.
Now
()
.
Unix
(),
10
))
return
nil
}
return
&
c
...
...
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