Mercurial > hg > rlgwebd
comparison rlgwebd.js @ 142:c4304f08e35b
RLGWebD: inprogress dirs have moved
author | John "Elwin" Edwards |
---|---|
date | Sun, 20 Oct 2013 19:26:39 -0700 |
parents | 1a156a7746a7 |
children | 81a8e7aa4687 |
comparison
equal
deleted
inserted
replaced
141:1a156a7746a7 | 142:c4304f08e35b |
---|---|
125 this.sessid, this.term.pid); | 125 this.sessid, this.term.pid); |
126 this.emit('open', true, this.sessid); | 126 this.emit('open', true, this.sessid); |
127 gamemux.emit('begin', this.sessid, this.pname, this.game.uname); | 127 gamemux.emit('begin', this.sessid, this.pname, this.game.uname); |
128 /* Set up the lockfile and ttyrec */ | 128 /* Set up the lockfile and ttyrec */ |
129 var ts = timestamp(); | 129 var ts = timestamp(); |
130 var progressdir = "/dgldir/inprogress-" + this.game.uname; | 130 var progressdir = path.join("/dgldir/inprogress", this.game.uname); |
131 this.lock = path.join(progressdir, this.pname + ":node:" + ts + ".ttyrec"); | 131 this.lock = path.join(progressdir, this.pname + ":node:" + ts + ".ttyrec"); |
132 var lmsg = this.term.pid.toString() + '\n' + this.h + '\n' + this.w + '\n'; | 132 var lmsg = this.term.pid.toString() + '\n' + this.h + '\n' + this.w + '\n'; |
133 fs.writeFile(this.lock, lmsg, "utf8"); | 133 fs.writeFile(this.lock, lmsg, "utf8"); |
134 var ttyrec = path.join("/dgldir/ttyrec", this.pname, this.game.uname, | 134 var ttyrec = path.join("/dgldir/ttyrec", this.pname, this.game.uname, |
135 ts + ".ttyrec"); | 135 ts + ".ttyrec"); |
480 | 480 |
481 /* Some functions which check whether a player is currently playing or | 481 /* Some functions which check whether a player is currently playing or |
482 * has a saved game. Maybe someday they will provide information on | 482 * has a saved game. Maybe someday they will provide information on |
483 * the game. */ | 483 * the game. */ |
484 function checkprogress(user, game, callback, args) { | 484 function checkprogress(user, game, callback, args) { |
485 var progressdir = "/dgldir/inprogress-" + game.uname; | 485 var progressdir = path.join("/dgldir/inprogress", game.uname); |
486 fs.readdir(progressdir, function(err, files) { | 486 fs.readdir(progressdir, function(err, files) { |
487 if (err) { | 487 if (err) { |
488 args.unshift(err, null); | 488 args.unshift(err, null); |
489 callback.apply(null, args); | 489 callback.apply(null, args); |
490 return; | 490 return; |
900 function checkback(err, fname) { | 900 function checkback(err, fname) { |
901 if (!fname) { | 901 if (!fname) { |
902 sendError(res, 7); | 902 sendError(res, 7); |
903 return; | 903 return; |
904 } | 904 } |
905 var fullfile = path.join("/dgldir/inprogress-" + gname, fname); | 905 var fullfile = path.join("/dgldir/inprogress", gname, fname); |
906 fs.readFile(fullfile, "utf8", function(err, fdata) { | 906 fs.readFile(fullfile, "utf8", function(err, fdata) { |
907 if (err) { | 907 if (err) { |
908 sendError(res, 7); | 908 sendError(res, 7); |
909 return; | 909 return; |
910 } | 910 } |