don't force image directories to be relative

This commit is contained in:
jomo 2015-08-20 01:52:01 +02:00
parent 9ed431d7ad
commit a928952dc4
3 changed files with 15 additions and 15 deletions

View File

@ -40,7 +40,7 @@ function connect_redis() {
// the helms file is ignored because we only need 1 file to read/write from // the helms file is ignored because we only need 1 file to read/write from
function update_file_date(rid, skin_hash) { function update_file_date(rid, skin_hash) {
if (skin_hash) { if (skin_hash) {
var face_path = path.join(__dirname, "..", config.directories.faces, skin_hash + ".png"); var face_path = path.join(config.directories.faces, skin_hash + ".png");
fs.exists(face_path, function(exists) { fs.exists(face_path, function(exists) {
if (exists) { if (exists) {
var date = new Date(); var date = new Date();

View File

@ -35,7 +35,7 @@ function should_clean_redis(callback) {
// callback: error, true|false // callback: error, true|false
function should_clean_disk(callback) { function should_clean_disk(callback) {
df({ df({
file: path.join(__dirname, "..", config.directories.faces), file: config.directories.faces,
prefixMultiplier: "KiB", prefixMultiplier: "KiB",
isDisplayPrefixMultiplier: false, isDisplayPrefixMultiplier: false,
precision: 2 precision: 2
@ -71,10 +71,10 @@ exp.run = function() {
logging.error(err); logging.error(err);
} else if (clean) { } else if (clean) {
logging.warn("DiskCleaner: Disk limit reached! Cleaning images now"); logging.warn("DiskCleaner: Disk limit reached! Cleaning images now");
var facesdir = path.join(__dirname, "..", config.directories.faces); var facesdir = config.directories.faces;
var helmdir = path.join(__dirname, "..", config.directories.helms); var helmdir = config.directories.helms;
var renderdir = path.join(__dirname, "..", config.directories.renders); var renderdir = config.directories.renders;
var skindir = path.join(__dirname, "..", config.directories.skins); var skindir = config.directories.skins;
fs.readdir(facesdir, function (readerr, files) { fs.readdir(facesdir, function (readerr, files) {
if (!readerr) { if (!readerr) {
for (var i = 0, l = Math.min(files.length, config.cleaner.amount); i < l; i++) { for (var i = 0, l = Math.min(files.length, config.cleaner.amount); i < l; i++) {

View File

@ -30,9 +30,9 @@ function store_skin(rid, userId, profile, cache_details, callback) {
}); });
} else { } else {
logging.debug(rid, "new skin hash:", skin_hash); logging.debug(rid, "new skin hash:", skin_hash);
var facepath = path.join(__dirname, "..", config.directories.faces, skin_hash + ".png"); var facepath = path.join(config.directories.faces, skin_hash + ".png");
var helmpath = path.join(__dirname, "..", config.directories.helms, skin_hash + ".png"); var helmpath = path.join(config.directories.helms, skin_hash + ".png");
var skinpath = path.join(__dirname, "..", config.directories.skins, skin_hash + ".png"); var skinpath = path.join(config.directories.skins, skin_hash + ".png");
fs.exists(facepath, function(exists) { fs.exists(facepath, function(exists) {
if (exists) { if (exists) {
logging.debug(rid, "skin already exists, not downloading"); logging.debug(rid, "skin already exists, not downloading");
@ -87,7 +87,7 @@ function store_cape(rid, userId, profile, cache_details, callback) {
}); });
} else { } else {
logging.debug(rid, "new cape hash:", cape_hash); logging.debug(rid, "new cape hash:", cape_hash);
var capepath = path.join(__dirname, "..", config.directories.capes, cape_hash + ".png"); var capepath = path.join(config.directories.capes, cape_hash + ".png");
fs.exists(capepath, function(exists) { fs.exists(capepath, function(exists) {
if (exists) { if (exists) {
logging.debug(rid, "cape already exists, not downloading"); logging.debug(rid, "cape already exists, not downloading");
@ -261,8 +261,8 @@ exp.get_image_hash = function(rid, userId, type, callback) {
exp.get_avatar = function(rid, userId, helm, size, callback) { exp.get_avatar = function(rid, userId, helm, size, callback) {
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) { exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) {
if (skin_hash) { if (skin_hash) {
var facepath = path.join(__dirname, "..", config.directories.faces, skin_hash + ".png"); var facepath = path.join(config.directories.faces, skin_hash + ".png");
var helmpath = path.join(__dirname, "..", config.directories.helms, skin_hash + ".png"); var helmpath = path.join(config.directories.helms, skin_hash + ".png");
var filepath = facepath; var filepath = facepath;
fs.exists(helmpath, function(exists) { fs.exists(helmpath, function(exists) {
if (helm && exists) { if (helm && exists) {
@ -288,7 +288,7 @@ exp.get_avatar = function(rid, userId, helm, size, callback) {
exp.get_skin = function(rid, userId, callback) { exp.get_skin = function(rid, userId, callback) {
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) { exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) {
if (skin_hash) { if (skin_hash) {
var skinpath = path.join(__dirname, "..", config.directories.skins, skin_hash + ".png"); var skinpath = path.join(config.directories.skins, skin_hash + ".png");
fs.exists(skinpath, function(exists) { fs.exists(skinpath, function(exists) {
if (exists) { if (exists) {
logging.debug(rid, "skin already exists, not downloading"); logging.debug(rid, "skin already exists, not downloading");
@ -323,7 +323,7 @@ exp.get_render = function(rid, userId, scale, helm, body, callback) {
callback(err, status, skin_hash, null); callback(err, status, skin_hash, null);
return; return;
} }
var renderpath = path.join(__dirname, "..", config.directories.renders, [skin_hash, scale, get_type(helm, body)].join("-") + ".png"); var renderpath = path.join(config.directories.renders, [skin_hash, scale, get_type(helm, body)].join("-") + ".png");
fs.exists(renderpath, function(exists) { fs.exists(renderpath, function(exists) {
if (exists) { if (exists) {
renders.open_render(rid, renderpath, function(render_err, rendered_img) { renders.open_render(rid, renderpath, function(render_err, rendered_img) {
@ -362,7 +362,7 @@ exp.get_cape = function(rid, userId, callback) {
callback(err, null, status, null); callback(err, null, status, null);
return; return;
} }
var capepath = path.join(__dirname, "..", config.directories.capes, cape_hash + ".png"); var capepath = path.join(config.directories.capes, cape_hash + ".png");
fs.exists(capepath, function(exists) { fs.exists(capepath, function(exists) {
if (exists) { if (exists) {
logging.debug(rid, "cape already exists, not downloading"); logging.debug(rid, "cape already exists, not downloading");