Skip to content

Commit d391dab

Browse files
committed
fixed merge conflict
2 parents e2a3480 + 7dcc7be commit d391dab

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

node/server.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ var socketIORouter;
4545
var version = "";
4646
try
4747
{
48-
var ref = fs.readFileSync("../.git/HEAD", "utf-8");
49-
var refPath = "../.git/" + ref.substring(5, ref.indexOf("\n"));
48+
var rootPath = path.normalize(__dirname + "/../")
49+
var ref = fs.readFileSync(rootPath + ".git/HEAD", "utf-8");
50+
var refPath = rootPath + ".git/" + ref.substring(5, ref.indexOf("\n"));
5051
version = fs.readFileSync(refPath, "utf-8");
5152
version = version.substring(0, 7);
5253
console.log("Your Etherpad Lite git version is " + version);

node/utils/Minify.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ exports.minifyJS = function(req, res, jsFilename)
5151
} else {
5252
throw new Error("there is no profile for creating " + name);
5353
}
54-
54+
55+
var rootPath = path.normalize(__dirname + "/../../" );
56+
5557
//minifying is enabled
5658
if(settings.minify)
5759
{
@@ -63,7 +65,7 @@ exports.minifyJS = function(req, res, jsFilename)
6365
//find out the highest modification date
6466
function(callback)
6567
{
66-
var folders2check = ["../static/css","../static/js"];
68+
var folders2check = [rootPath + "static/css", rootPath + "static/js"];
6769

6870
//go trough this two folders
6971
async.forEach(folders2check, function(path, callback)
@@ -102,7 +104,7 @@ exports.minifyJS = function(req, res, jsFilename)
102104
function(callback)
103105
{
104106
//check the modification time of the minified js
105-
fs.stat("../var/minified_" + jsFilename, function(err, stats)
107+
fs.stat(rootPath + "var/minified_" + jsFilename, function(err, stats)
106108
{
107109
if(err && err.code != "ENOENT")
108110
{
@@ -127,7 +129,7 @@ exports.minifyJS = function(req, res, jsFilename)
127129
{
128130
async.forEach(jsFiles, function (item, callback)
129131
{
130-
fs.readFile("../static/js/" + item, "utf-8", function(err, data)
132+
fs.readFile(rootPath + "static/js/" + item, "utf-8", function(err, data)
131133
{
132134
if(ERR(err, callback)) return;
133135
fileValues[item] = data;
@@ -205,7 +207,7 @@ exports.minifyJS = function(req, res, jsFilename)
205207
//write the results plain in a file
206208
function(callback)
207209
{
208-
fs.writeFile("../var/minified_" + jsFilename, result, "utf8", callback);
210+
fs.writeFile(rootPath + "var/minified_" + jsFilename, result, "utf8", callback);
209211
},
210212
//write the results compressed in a file
211213
function(callback)
@@ -219,7 +221,7 @@ exports.minifyJS = function(req, res, jsFilename)
219221

220222
if(ERR(err, callback)) return;
221223

222-
fs.writeFile("../var/minified_" + jsFilename + ".gz", compressedResult, callback);
224+
fs.writeFile(rootPath + "var/minified_" + jsFilename + ".gz", compressedResult, callback);
223225
});
224226
}
225227
//skip this step on windows
@@ -243,12 +245,12 @@ exports.minifyJS = function(req, res, jsFilename)
243245
var pathStr;
244246
if(gzipSupport && os.type().indexOf("Windows") == -1)
245247
{
246-
pathStr = path.normalize(__dirname + "/../../var/minified_" + jsFilename + ".gz");
248+
pathStr = path.normalize(rootPath + "var/minified_" + jsFilename + ".gz");
247249
res.header('Content-Encoding', 'gzip');
248250
}
249251
else
250252
{
251-
pathStr = path.normalize(__dirname + "/../../var/minified_" + jsFilename );
253+
pathStr = path.normalize(rootPath + "var/minified_" + jsFilename );
252254
}
253255

254256
res.sendfile(pathStr, { maxAge: server.maxAge });
@@ -262,7 +264,7 @@ exports.minifyJS = function(req, res, jsFilename)
262264
//read all js files
263265
async.forEach(jsFiles, function (item, callback)
264266
{
265-
fs.readFile("../static/js/" + item, "utf-8", function(err, data)
267+
fs.readFile(rootPath + "static/js/" + item, "utf-8", function(err, data)
266268
{
267269
if(ERR(err, callback)) return;
268270
fileValues[item] = data;

node/utils/Settings.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
var fs = require("fs");
2323
var os = require("os");
24+
var path = require('path');
2425

2526
/**
2627
* The IP ep-lite should listen to
@@ -88,7 +89,8 @@ exports.abiwordAvailable = function()
8889
}
8990

9091
//read the settings sync
91-
var settingsStr = fs.readFileSync("../settings.json").toString();
92+
var settingsPath = path.normalize(__dirname + "/../../");
93+
var settingsStr = fs.readFileSync(settingsPath + "settings.json").toString();
9294

9395
//remove all comments
9496
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");

0 commit comments

Comments
 (0)