Skip to content

Commit 588de73

Browse files
committed
refactor(files): move listDir implementation to FileService and remove from Unix/WindowsFilesService
1 parent 0542e74 commit 588de73

3 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/core/services/files/files.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ export abstract class FileService implements IFileService {
1919
this.fileWorkerService = fileWorkerService;
2020
}
2121

22-
abstract listDir(path: string, params: ScanOptions): Observable<string>;
2322
abstract deleteDir(path: string): Promise<boolean>;
2423

24+
listDir(path: string, params: ScanOptions): Observable<string> {
25+
const stream$ = new Subject<string>();
26+
this.fileWorkerService.startScan(stream$, { ...params, rootPath: path });
27+
return stream$;
28+
}
29+
2530
getFolderSize(path: string): Observable<number> {
2631
const stream$ = new Subject<number>();
2732
this.fileWorkerService.getFolderSize(stream$, path);

src/core/services/files/unix-files.service.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ export class UnixFilesService extends FileService {
1414
super(fileWorkerService);
1515
}
1616

17-
listDir(path: string, params: ScanOptions): Observable<string> {
18-
const stream$ = new Subject<string>();
19-
this.fileWorkerService.startScan(stream$, { ...params, rootPath: path });
20-
return stream$;
21-
}
22-
2317
async deleteDir(path: string): Promise<boolean> {
2418
return new Promise((resolve, reject) => {
2519
const command = `rm -rf "${path}"`;

src/core/services/files/windows-files.service.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ export class WindowsFilesService extends FileService {
1313
super(fileWorkerService);
1414
}
1515

16-
listDir(path: string, params: ScanOptions): Observable<string> {
17-
const stream$ = new Subject<string>();
18-
this.fileWorkerService.startScan(stream$, { ...params, rootPath: path });
19-
return stream$;
20-
}
21-
2216
async deleteDir(path: string): Promise<boolean> {
2317
await rm(path, { recursive: true, force: true });
2418
return true;

0 commit comments

Comments
 (0)