1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-27 02:09:16 +02: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);
}
public static excludeDir(name: string,relativeDirectoryName: string, absoluteDirectoryName: string) {
const absoluteName=path.normalize(path.join(absoluteDirectoryName,name));
const relativeName=path.normalize(path.join(relativeDirectoryName,name));
public static excludeDir(name: string, relativeDirectoryName: string, absoluteDirectoryName: string) {
const absoluteName = path.normalize(path.join(absoluteDirectoryName, name));
const relativeName = path.normalize(path.join(relativeDirectoryName, name));
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==absoluteName) {
if (exclude === absoluteName) {
return true;
}
} else if (exclude.includes('/')) {
if (path.normalize(exclude)==relativeName) {
if (path.normalize(exclude) === relativeName) {
return true;
}
} else {
if (exclude==name) {
if (exclude === name) {
return true;
}
}
}
// exclude dirs that have the given files (like .ignore)
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;
}
}
@ -123,7 +123,7 @@ export class DiskMangerWorker {
if (photosOnly === true) {
continue;
}
if (DiskMangerWorker.excludeDir(file,relativeDirectoryName,absoluteDirectoryName)) {
if (DiskMangerWorker.excludeDir(file, relativeDirectoryName, absoluteDirectoryName)) {
continue;
}
const d = await DiskMangerWorker.scanDirectory(path.join(relativeDirectoryName, file),

View File

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