1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

retouching filder ignoring

This commit is contained in:
Patrik J. Braun 2019-12-07 18:26:29 +01:00
parent b47d0ea675
commit a952d927b6
2 changed files with 13 additions and 13 deletions

View File

@ -57,32 +57,32 @@ export class DiskMangerWorker {
return path.basename(name); return path.basename(name);
} }
public static excludeDir(name: string,relativeDirectoryName: string, absoluteDirectoryName: string) { public static excludeDir(name: string, relativeDirectoryName: string, absoluteDirectoryName: string) {
const absoluteName=path.normalize(path.join(absoluteDirectoryName,name)); const absoluteName = path.normalize(path.join(absoluteDirectoryName, name));
const relativeName=path.normalize(path.join(relativeDirectoryName,name)); const relativeName = path.normalize(path.join(relativeDirectoryName, name));
for (let j = 0; j < Config.Server.indexing.excludeFolderList.length; j++) { for (let j = 0; j < Config.Server.indexing.excludeFolderList.length; j++) {
const exclude=Config.Server.indexing.excludeFolderList[j]; const exclude = Config.Server.indexing.excludeFolderList[j];
if (exclude.startsWith('/')) { if (exclude.startsWith('/')) {
if (exclude==absoluteName) { if (exclude === absoluteName) {
return true; return true;
} }
} else if (exclude.includes('/')) { } else if (exclude.includes('/')) {
if (path.normalize(exclude)==relativeName) { if (path.normalize(exclude) === relativeName) {
return true; return true;
} }
} else { } else {
if (exclude==name) { if (exclude === name) {
return true; return true;
} }
} }
} }
// exclude dirs that have the given files (like .ignore)
for (let j = 0; j < Config.Server.indexing.excludeFileList.length; j++) { for (let j = 0; j < Config.Server.indexing.excludeFileList.length; j++) {
const exclude=Config.Server.indexing.excludeFileList[j]; const exclude = Config.Server.indexing.excludeFileList[j];
if (fs.existsSync(path.join(absoluteName,exclude))) { if (fs.existsSync(path.join(absoluteName, exclude))) {
return true; return true;
} }
} }
@ -123,7 +123,7 @@ export class DiskMangerWorker {
if (photosOnly === true) { if (photosOnly === true) {
continue; continue;
} }
if (DiskMangerWorker.excludeDir(file,relativeDirectoryName,absoluteDirectoryName)) { if (DiskMangerWorker.excludeDir(file, relativeDirectoryName, absoluteDirectoryName)) {
continue; continue;
} }
const d = await DiskMangerWorker.scanDirectory(path.join(relativeDirectoryName, file), const d = await DiskMangerWorker.scanDirectory(path.join(relativeDirectoryName, file),

View File

@ -67,12 +67,12 @@
<div class="form-group row"> <div class="form-group row">
<label class="col-md-2 control-label" for="excludeFileList" i18n>Exclude File List</label> <label class="col-md-2 control-label" for="excludeFileList" i18n>Exclude File List</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" class="form-control" placeholder="" <input type="text" class="form-control" placeholder=".ignore; .pg2ignore"
id="excludeFileList" id="excludeFileList"
[(ngModel)]="excludeFileList" [(ngModel)]="excludeFileList"
name="excludeFileList" required> name="excludeFileList" required>
<small class="form-text text-muted"> <small class="form-text text-muted">
<ng-container i18n>FFiles that mark a folder to be excluded from indexing</ng-container><br/> <ng-container i18n>Files that mark a folder to be excluded from indexing</ng-container><br/>
<ng-container <ng-container
i18n>';' separated strings. Any folder that contains a file with this name will be excluded from indexing.</ng-container> i18n>';' separated strings. Any folder that contains a file with this name will be excluded from indexing.</ng-container>
</small> </small>