mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-30 06:37:36 +00:00
[Fix] SettingProperties 修复了配置文件无法创建, 导致无法保存配置的问题;
[Fix] Main 修复了潜在的文件创建失败的问题;
This commit is contained in:
parent
6bace4b048
commit
66b22c543a
@ -398,7 +398,7 @@ public class Main {
|
||||
private static void saveCookieStoreToFile() throws IOException {
|
||||
log.info("正在保存CookieStore...");
|
||||
File outputFile = new File(System.getProperty("cgj.botDataDir"), "cookies.store");
|
||||
if(!outputFile.exists() && !outputFile.delete() && !outputFile.createNewFile()){
|
||||
if(!outputFile.exists() && !outputFile.createNewFile()){
|
||||
log.error("保存CookieStore失败.");
|
||||
return;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import java.util.*;
|
||||
|
||||
public final class SettingProperties {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger("SettingProperties");
|
||||
private final static Logger log = LoggerFactory.getLogger(SettingProperties.class.getName());
|
||||
|
||||
private final static File globalPropFile = new File(getPropertiesDir(), "global.properties");
|
||||
private final static Properties globalProp = new Properties();
|
||||
@ -95,7 +95,7 @@ public final class SettingProperties {
|
||||
|
||||
private static void saveGroupProperties(Long groupId, Properties properties) throws IOException {
|
||||
File groupPropFile = new File(getPropertiesDir(), "group." + groupId + ".properties");
|
||||
if((!groupPropFile.exists() || !groupPropFile.isFile()) && (!groupPropFile.delete() || !groupPropFile.createNewFile())) {
|
||||
if(!groupPropFile.exists() && !groupPropFile.createNewFile()) {
|
||||
log.error("群组 {} 配置文件创建失败!", groupId);
|
||||
return;
|
||||
}
|
||||
@ -122,7 +122,7 @@ public final class SettingProperties {
|
||||
*/
|
||||
private static void saveGlobalProperties() {
|
||||
try {
|
||||
if((!globalPropFile.exists() || !globalPropFile.isFile()) && (!globalPropFile.delete() || !globalPropFile.createNewFile())) {
|
||||
if(!globalPropFile.exists() && !globalPropFile.createNewFile()) {
|
||||
log.error("创建全局配置文件失败.");
|
||||
return;
|
||||
}
|
||||
@ -158,7 +158,7 @@ public final class SettingProperties {
|
||||
*/
|
||||
private static File getPropertiesDir() {
|
||||
File propDir = new File(System.getProperty("cgj.botDataDir"), "/setting/");
|
||||
if((!propDir.exists() || !propDir.isDirectory()) && (!propDir.delete() || !propDir.mkdirs())) {
|
||||
if(!propDir.exists() && !propDir.mkdirs()) {
|
||||
log.warn("Setting文件夹创建失败!");
|
||||
}
|
||||
return propDir;
|
||||
|
Loading…
Reference in New Issue
Block a user