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

improving diagnostics

This commit is contained in:
Braun Patrik 2017-07-14 22:56:25 +02:00
parent be74b854b7
commit 1d63cfaca4
2 changed files with 8 additions and 2 deletions

View File

@ -15,10 +15,14 @@ class ProjectPathClass {
return path.join(pathStr, path.sep);
}
getAbsolutePath(pathStr: string): string {
return this.isAbsolutePath(pathStr) ? pathStr : path.join(this.Root, pathStr);
}
constructor() {
this.Root = path.join(__dirname, "/../");
this.ImageFolder = this.isAbsolutePath(Config.Server.imagesFolder) ? Config.Server.imagesFolder : path.join(this.Root, Config.Server.imagesFolder);
this.ThumbnailFolder = this.isAbsolutePath(Config.Server.thumbnail.folder) ? Config.Server.thumbnail.folder : path.join(this.Root, Config.Server.thumbnail.folder);
this.ImageFolder = this.getAbsolutePath(Config.Server.imagesFolder);
this.ThumbnailFolder = this.getAbsolutePath(Config.Server.thumbnail.folder);
this.FrontendFolder = path.join(this.Root, 'dist')
}
}

View File

@ -43,6 +43,7 @@ export class ConfigDiagnostics {
static async testThumbnailFolder(folder: string) {
await new Promise((resolve, reject) => {
folder = ProjectPath.getAbsolutePath(folder);
if (!fs.existsSync(folder)) {
reject("Thumbnail folder not exists: '" + folder + "'");
}
@ -57,6 +58,7 @@ export class ConfigDiagnostics {
static async testImageFolder(folder: string) {
await new Promise((resolve, reject) => {
folder = ProjectPath.getAbsolutePath(folder);
if (!fs.existsSync(folder)) {
reject("Images folder not exists: '" + folder + "'");
}