Permalink
Browse files

Make it possible to start backend from any path

  • Loading branch information...
1 parent fc7a24e commit 3bda2eb1b9a2eb1f365e3ea002765ea35251d598 @alexanderteinum alexanderteinum committed Apr 26, 2013
Showing with 6 additions and 3 deletions.
  1. +2 −1 backend/main.coffee
  2. +4 −2 backend/main.js
View
@@ -1,4 +1,5 @@
fs = require 'fs'
+path = require 'path'
io = require('socket.io').listen(4563)
request = require 'request'
_ = require 'underscore'
@@ -88,7 +89,7 @@ io.sockets.on 'connection', (socket) ->
if locale isnt 'no' and locale isnt 'en'
return
- fs.readFile 'locale/' + locale + '.json', 'utf8', (err, data) ->
+ fs.readFile path.resolve(__dirname, 'locale/', locale + '.json'), 'utf8', (err, data) ->
if err
throw err
View
@@ -1,9 +1,11 @@
// Generated by CoffeeScript 1.6.2
(function() {
- var fs, getLanguage, io, languages, request, requestUrl, transformResult, transformResults, transformVerifyResult, _;
+ var fs, getLanguage, io, languages, path, request, requestUrl, transformResult, transformResults, transformVerifyResult, _;
fs = require('fs');
+ path = require('path');
+
io = require('socket.io').listen(4563);
request = require('request');
@@ -106,7 +108,7 @@
if (locale !== 'no' && locale !== 'en') {
return;
}
- return fs.readFile('locale/' + locale + '.json', 'utf8', function(err, data) {
+ return fs.readFile(path.resolve(__dirname, 'locale/', locale + '.json'), 'utf8', function(err, data) {
if (err) {
throw err;
}

0 comments on commit 3bda2eb

Please sign in to comment.