get the proper git revision even when not started from node dir

pull/314/head
Azul 2012-01-05 11:35:40 +01:00
parent b1faa8e0f8
commit 7dcc7be8e0
1 changed files with 3 additions and 2 deletions

View File

@ -45,8 +45,9 @@ var socketIORouter;
var version = ""; var version = "";
try try
{ {
var ref = fs.readFileSync("../.git/HEAD", "utf-8"); var rootPath = path.normalize(__dirname + "/../")
var refPath = "../.git/" + ref.substring(5, ref.indexOf("\n")); var ref = fs.readFileSync(rootPath + ".git/HEAD", "utf-8");
var refPath = rootPath + ".git/" + ref.substring(5, ref.indexOf("\n"));
version = fs.readFileSync(refPath, "utf-8"); version = fs.readFileSync(refPath, "utf-8");
version = version.substring(0, 7); version = version.substring(0, 7);
console.log("Your Etherpad Lite git version is " + version); console.log("Your Etherpad Lite git version is " + version);