1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/ProjectPath.ts

20 lines
781 B
TypeScript
Raw Normal View History

import * as path from "path";
import {Config} from "./config/Config";
class ProjectPathClass {
public Root:string;
public ImageFolder:string;
public ThumbnailFolder:string;
2016-06-25 20:13:06 +08:00
isAbsolutePath(pathStr) {
return path.resolve(pathStr) === path.normalize(pathStr).replace(RegExp(pathStr.sep + '$'), '');
}
constructor() {
this.Root = path.join(__dirname, "/../");
2016-06-25 20:13:06 +08:00
this.ImageFolder = this.isAbsolutePath(Config.Server.imagesFolder) ? Config.Server.imagesFolder : path.join(this.Root, Config.Server.imagesFolder);
this.ThumbnailFolder = this.isAbsolutePath(Config.Server.thumbnailFolder) ? Config.Server.thumbnailFolder : path.join(this.Root, Config.Server.thumbnailFolder);
}
}
export var ProjectPath = new ProjectPathClass();