Skip to content

Commit 9ed7c37

Browse files
committed
读取配置文件前先用getInfo检查是否存在
1 parent 48425f5 commit 9ed7c37

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

conf.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ function love.conf(t)
99

1010
local fs=love.filesystem
1111
fs.setIdentity(identity)
12-
do -- Load grapgic settings from conf/settings
12+
if fs.getInfo('conf/settings') then -- Load grapgic settings from conf/settings
1313
local fileData=fs.read('conf/settings')
14-
if fileData then
15-
msaa=tonumber(fileData:match('"msaa":(%d+)')) or 0;
16-
portrait=MOBILE and fileData:find('"portrait":true') and true
17-
end
14+
msaa=tonumber(fileData:match('"msaa":(%d+)')) or 0;
15+
portrait=MOBILE and fileData:find('"portrait":true') and true
1816
end
1917

2018
t.identity=identity -- Saving folder

0 commit comments

Comments
 (0)