Skip to content

Commit

Permalink
correct fs.filecount handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mschlgl committed Feb 28, 2024
1 parent 206910f commit 30c7ac5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ class Extron extends utils.Adapter {
**/
//await this.delObjectAsync(`fs.files`,{recursive: true}); // delete files object from database
//await this.setObjectAsync(`fs.files`, this.objectsTemplate.userflash.file); // recreate files object
i = 1;
i = 0;
for (const userFile of userFileList) { // check each line
if (this.fileList.freeSpace) continue; // skip remaining lines if last entry already found
// @ts-ignore
Expand All @@ -2048,15 +2048,15 @@ class Extron extends utils.Adapter {
// @ts-ignore
this.file.fileSize = userFile.match(/(\d+)$/g)?`${userFile.match(/(\d+)$/g)[0]}`:''; // extract filesize
if (this.file.fileName.match(/.raw$/)) { // check if AudioFile
i++;
this.fileList.files[i] = this.file; // add to filelist array
await this.setObjectAsync(`fs.files.${i}`, this.objectsTemplate.userflash.files[0]);
await this.setObjectAsync(`fs.files.${i}.filename`, this.objectsTemplate.userflash.files[1]);
this.setState(`fs.files.${i}.filename`, this.file.fileName, true);
this.setState(`fs.filecount`, i, true);
i++;
//this.setState(`fs.filecount`, i, true);
}
}
//this.setState(`fs.filecount`, this.fileList.files.length, true);
this.setState(`fs.filecount`, i, true);
this.setState('fs.freespace',this.fileList.freeSpace,true);
this.setState('fs.dir',false,true);
} catch (err) {
Expand Down

0 comments on commit 30c7ac5

Please sign in to comment.