2016-06-22 16:34:44 +02:00
|
|
|
import * as path from "path";
|
|
|
|
import {Config} from "./config/Config";
|
|
|
|
|
|
|
|
class ProjectPathClass {
|
2016-12-27 00:36:38 +02:00
|
|
|
public Root: string;
|
|
|
|
public ImageFolder: string;
|
|
|
|
public ThumbnailFolder: string;
|
2016-06-22 16:34:44 +02:00
|
|
|
|
2016-12-27 00:36:38 +02:00
|
|
|
isAbsolutePath(pathStr: string) {
|
|
|
|
return path.resolve(pathStr) === path.normalize(pathStr);
|
2016-06-25 14:13:06 +02:00
|
|
|
}
|
|
|
|
|
2016-06-22 16:34:44 +02:00
|
|
|
constructor() {
|
|
|
|
this.Root = path.join(__dirname, "/../");
|
2016-06-25 14:13:06 +02: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);
|
2016-06-22 16:34:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-27 00:36:38 +02:00
|
|
|
export let ProjectPath = new ProjectPathClass();
|