Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ajaxorg/jsDAV into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedeboer committed Sep 23, 2010
2 parents 25718cf + 46f9125 commit 803c57f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lib/DAV/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
var Http = require("http"),
Url = require("url"),
Sys = require("sys"),
Fs = require("fs"),
Exc = require("./exceptions"),

// DAV classes used directly by the Server object
Expand All @@ -18,8 +19,21 @@ var Http = require("http"),
jsDAV_ObjectTree = require("./objectTree").jsDAV_ObjectTree,
jsDAV_Tree_Filesystem = require("./tree/filesystem").jsDAV_Tree_Filesystem;

exports.DEFAULT_PORT = 41197;
exports.DEFAULT_HOST = "127.0.0.1";
exports.DEFAULT_PORT = 41197;
exports.DEFAULT_HOST = "127.0.0.1";
exports.DEFAULT_TMPDIR = (function() {
var value,
def = "/tmp",
envVars = ["TMPDIR", "TMP", "TEMP"],
i = 0,
l = envVars.length;
for(; i < l; ++i) {
value = process.env[envVars[i]];
if (value)
return Fs.realpathSync(value);
}
return Fs.realpathSync(def);
})();

function Server(options) {
/**
Expand Down Expand Up @@ -49,10 +63,10 @@ function Server(options) {
+ "a valid path to a location on the local filesystem or null");
}

this.tmpDir = (options && options.tmpDir) || "/tmp";
this.tmpDir = (options && options.tmpDir) || exports.DEFAULT_TMPDIR;
var idx;
if ((idx = this.tmpDir.lastIndexOf("/")) == this.tmpDir.length - 1)
this.tmpDir = this.tmpDir.substring(0, idx - 1);
this.tmpDir = this.tmpDir.substring(0, idx);

if (options.server && options.mount) { //use an existing server object
var _self = this;
Expand Down

0 comments on commit 803c57f

Please sign in to comment.