You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-03 23:00:25 +02:00
improving diagnostics
This commit is contained in:
@@ -15,10 +15,14 @@ class ProjectPathClass {
|
|||||||
return path.join(pathStr, path.sep);
|
return path.join(pathStr, path.sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAbsolutePath(pathStr: string): string {
|
||||||
|
return this.isAbsolutePath(pathStr) ? pathStr : path.join(this.Root, pathStr);
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.Root = path.join(__dirname, "/../");
|
this.Root = path.join(__dirname, "/../");
|
||||||
this.ImageFolder = this.isAbsolutePath(Config.Server.imagesFolder) ? Config.Server.imagesFolder : path.join(this.Root, Config.Server.imagesFolder);
|
this.ImageFolder = this.getAbsolutePath(Config.Server.imagesFolder);
|
||||||
this.ThumbnailFolder = this.isAbsolutePath(Config.Server.thumbnail.folder) ? Config.Server.thumbnail.folder : path.join(this.Root, Config.Server.thumbnail.folder);
|
this.ThumbnailFolder = this.getAbsolutePath(Config.Server.thumbnail.folder);
|
||||||
this.FrontendFolder = path.join(this.Root, 'dist')
|
this.FrontendFolder = path.join(this.Root, 'dist')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export class ConfigDiagnostics {
|
|||||||
|
|
||||||
static async testThumbnailFolder(folder: string) {
|
static async testThumbnailFolder(folder: string) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
|
folder = ProjectPath.getAbsolutePath(folder);
|
||||||
if (!fs.existsSync(folder)) {
|
if (!fs.existsSync(folder)) {
|
||||||
reject("Thumbnail folder not exists: '" + folder + "'");
|
reject("Thumbnail folder not exists: '" + folder + "'");
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ export class ConfigDiagnostics {
|
|||||||
|
|
||||||
static async testImageFolder(folder: string) {
|
static async testImageFolder(folder: string) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
|
folder = ProjectPath.getAbsolutePath(folder);
|
||||||
if (!fs.existsSync(folder)) {
|
if (!fs.existsSync(folder)) {
|
||||||
reject("Images folder not exists: '" + folder + "'");
|
reject("Images folder not exists: '" + folder + "'");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user