2016-06-22 22:34:44 +08:00
|
|
|
import * as path from "path";
|
2017-06-04 21:25:08 +08:00
|
|
|
import {Config} from "../common/config/private/Config";
|
2016-06-22 22:34:44 +08:00
|
|
|
|
|
|
|
class ProjectPathClass {
|
2017-06-11 04:32:56 +08:00
|
|
|
public Root: string;
|
|
|
|
public ImageFolder: string;
|
|
|
|
public ThumbnailFolder: string;
|
2017-07-04 01:17:49 +08:00
|
|
|
public FrontendFolder: string;
|
2016-06-22 22:34:44 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
isAbsolutePath(pathStr: string) {
|
|
|
|
return path.resolve(pathStr) === path.normalize(pathStr);
|
|
|
|
}
|
2016-06-25 20:13:06 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
normalizeRelative(pathStr: string) {
|
|
|
|
return path.join(pathStr, path.sep);
|
|
|
|
}
|
2016-12-28 21:26:19 +08:00
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
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);
|
2017-07-04 01:17:49 +08:00
|
|
|
this.FrontendFolder = path.join(this.Root, 'dist')
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|
2016-06-22 22:34:44 +08:00
|
|
|
}
|
|
|
|
|
2017-06-11 04:32:56 +08:00
|
|
|
export const ProjectPath = new ProjectPathClass();
|