Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- **** PathConstructor.js
- ***/
- function PathConstructor(path_to_object, is_absolute) {
- if(is_absolute){
- this.lock_relative = true;
- this.absolute_path = path_to_object;
- }
- else {
- this.relative_path = path_to_object;
- }
- this.getRel = function(){
- if(this.lock_relative){
- throw "This path is abolsute!";
- }
- return this.relative_path;
- }
- this.getAbs = function(){
- if(this.relative_path === undefined && this.absolute_path !== undefined){
- return this.absolute_path;
- }
- return path.join(PATH_TO_MAIN, this.relative_path);
- }
- return this;
- }
- exports = PathConstructor;
- /***
- **** Następnie w index.js:
- ***/
- var PathConstructor = require("./classes/PathConstructor.js");
- var PATH_TO_SCRIPTS = new PathConstructor("./Scripts", false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement