@@ -362,33 +362,37 @@ function music.loadStageMusicInDir(stageid, name)
362
362
for k , file in ipairs (files ) do
363
363
local filepath = (" %s/%s" ):format (name , file )
364
364
local info = love .filesystem .getInfo (filepath )
365
- if info .type == " file" then
366
- local ext = string .getFileExtension (file ):lower ()
367
-
368
- if valid_music_ext [ext ] then
369
- local success , source = pcall (love .audio .newSource , filepath , " stream" )
370
- if success and source then
371
- loaded = loaded + 1
372
-
373
- -- Insert the newly loaded track into a random position in the playlist
374
- local pos = math.random (1 , # music .PLAYLIST )
375
- local prob = tonumber (string.match (filepath , " [^%._\n ]+_(%d+)%.%w+$" )) or 1
376
-
377
- if prob > 1 then
378
- music .USE_WEIGHTS = true
379
- end
380
-
381
- local wavinfo
382
- if ext == " wav" then
383
- wavinfo = wav .parse (filepath )
365
+ if info then
366
+ if info .type == " file" then
367
+ local ext = string .getFileExtension (file ):lower ()
368
+
369
+ if valid_music_ext [ext ] then
370
+ local success , source = pcall (love .audio .newSource , filepath , " stream" )
371
+ if success and source then
372
+ loaded = loaded + 1
373
+
374
+ -- Insert the newly loaded track into a random position in the playlist
375
+ local pos = math.random (1 , # music .PLAYLIST )
376
+ local prob = tonumber (string.match (filepath , " [^%._\n ]+_(%d+)%.%w+$" )) or 1
377
+
378
+ if prob > 1 then
379
+ music .USE_WEIGHTS = true
380
+ end
381
+
382
+ local wavinfo
383
+ if ext == " wav" then
384
+ wavinfo = wav .parse (filepath )
385
+ end
386
+ table.insert (music .PLAYLIST , pos , {STREAM = source , WEIGHT = prob , WAV = wavinfo })
387
+ else
388
+ local err = (" invalid music file \" %s/%s\" " ):format (name , file )
389
+ log .error (" [MUSIC] %s" , err )
390
+ notification .error (err )
384
391
end
385
- table.insert (music .PLAYLIST , pos , {STREAM = source , WEIGHT = prob , WAV = wavinfo })
386
- else
387
- local err = (" invalid music file \" %s/%s\" " ):format (name , file )
388
- log .error (" [MUSIC] %s" , err )
389
- notification .error (err )
390
392
end
391
393
end
394
+ else
395
+ log .warn (" [MUSIC] Unable to get file information for file %q" , filepath )
392
396
end
393
397
end
394
398
if loaded > 0 then
0 commit comments