mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Fix some sonarcloud issues
This commit is contained in:
@@ -77,7 +77,7 @@ export class LocalPlaylistsManagerService {
|
||||
}
|
||||
|
||||
private async getPlaylistsFolder(version?: BSVersion) {
|
||||
const rootPath = version ? await this.versions.getVersionPath(version) : await this.bsmFs.sharedContentPath();
|
||||
const rootPath = version ? await this.versions.getVersionPath(version) : this.bsmFs.sharedContentPath();
|
||||
const fullPath = path.join(rootPath, this.PLAYLISTS_FOLDER);
|
||||
|
||||
await ensureDir(fullPath);
|
||||
@@ -179,7 +179,7 @@ export class LocalPlaylistsManagerService {
|
||||
|
||||
const tryExtractPlaylistId = (url: string) => {
|
||||
const regex = /\/id\/(\d+)\/download/;
|
||||
const match = url.match(regex);
|
||||
const match = regex.exec(url);
|
||||
return match ? Number(match[1]) : undefined;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ export class LocalPlaylistsManagerService {
|
||||
return undefined;
|
||||
}).filter(Boolean);
|
||||
|
||||
if(songsDetails && songsDetails.length){
|
||||
if(songsDetails?.length){
|
||||
bpListDetails.duration = songsDetails.reduce((acc, song) => acc + song.duration, 0);
|
||||
bpListDetails.nbMappers = new Set(songsDetails.map(s => s.uploader.id)).size;
|
||||
bpListDetails.minNps = Math.min(...songsDetails.map(s => Math.min(...s.difficulties.map(d => d.nps || 0))));
|
||||
|
||||
@@ -90,7 +90,7 @@ export class LocalMapsManagerService {
|
||||
if (version) {
|
||||
return path.join(await this.localVersion.getVersionPath(version), LocalMapsManagerService.RELATIVE_MAPS_FOLDER);
|
||||
}
|
||||
const sharedMapsPath = path.join(await this.installLocation.sharedContentPath(), LocalMapsManagerService.SHARED_MAPS_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER);
|
||||
const sharedMapsPath = path.join(this.installLocation.sharedContentPath(), LocalMapsManagerService.SHARED_MAPS_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER);
|
||||
if (!(await pathExist(sharedMapsPath))) {
|
||||
await ensureFolderExist(sharedMapsPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user