Allow absolute paths in configuration settings.

- before absolute paths would be expanded incorrectly, e.g.: fooPath=/a/b/c would become /path/to/yacy/root/a/b/c. Now you can put nearly every dynamically generated data with a configurable path to a location outside of yacys root dir without having to use symlinks (probably good for third party distribution packaging).
- abstractServerSwitch.getConfigPath(setting, default) returns a File instance, either with an absolute path or relative to the applications root path.

- exceptions (hardcoded): 
  DATA/LOG/yacy.logging
  DATA/SETTINGS/httpProxy.conf
  DATA/SETTINGS/user.db
TODO: all of these are the global configuration files and they should probably be put into _one_ command line configurable settings path, so it would be possible to package them in /etc/ for example.

- add missing workPath to yacy.init (it was used in code, but there was no default in the file)
- fix broken skinPath (was skinsPath in yacy.init but skinsPath in the code) + a few other broken config reading caused by typos.
- replaced path setting names and their default values with the related static fields in plasmaSwitchboard where not already done/existing

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4196 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
fuchsi 18 years ago
parent e8d32d9f62
commit 425e4ead66

@ -99,7 +99,7 @@ public class AccessTracker_p {
while (ii.hasNext()) {
entry = (Map.Entry) ii.next();
prop.putHTML("page_list_" + entCount + "_host", host);
prop.putHTML("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
prop.put("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());
entCount++;
}
@ -214,7 +214,7 @@ public class AccessTracker_p {
yacySeed remotepeer = yacyCore.seedDB.lookupByIP(natLib.getInetAddress(host), true, true, true);
prop.putHTML("page_list_" + entCount + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());
}
prop.putHTML("page_list_" + entCount + "_count", new Integer(handles.size()).toString());
prop.putNum("page_list_" + entCount + "_count", handles.size());
// next
entCount++;

@ -176,7 +176,7 @@ public class BlogComments {
// finally write notification
File notifierSource = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath","htroot") + "/env/grafics/message.gif");
File notifierDest = new File(switchboard.getConfig("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
File notifierDest = new File(switchboard.getConfigPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {

@ -210,7 +210,7 @@ public class CacheAdmin_p {
}
// generate sorted dir/file listing
final String[] list = dir.list(new Filter(new File(switchboard.getConfig(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT))));
final String[] list = dir.list(new Filter(switchboard.getConfigPath(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT)));
tree.ensureCapacity((list == null) ? 70 : (list.length + 1) * 256);
linkPathString(prop, ((pathString.length() == 0) ? ("/") : (pathString)), true);
if (list == null) {

@ -62,7 +62,7 @@ public class CacheResource_p {
String path = ((post == null) ? "" : post.get("path", ""));
// we dont need check the path, because we have do that in plasmaSwitchboard.java - Borg-0300
File cache = new File(switchboard.getConfig("proxyCache", "DATA/HTCACHE").toString());
File cache = switchboard.getConfigPath(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT);
File f = new File(cache, path);
byte[] resource;

@ -47,7 +47,6 @@
// javac -classpath .:../classes ConfigBasic_p.java
// if the shell's current path is HTROOT
import java.io.File;
import java.lang.Integer;
import java.util.regex.Pattern;
@ -80,7 +79,7 @@ public class ConfigBasic {
ConfigBasic config = new ConfigBasic();
plasmaSwitchboard sb = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
String langPath = new File(env.getRootPath(), env.getConfig("locale.work", "DATA/LOCALE/locales")).toString();
String langPath = env.getConfigPath("locale.work", "DATA/LOCALE/locales").getAbsolutePath();
String lang = env.getConfig("locale.language", "default");
int authentication = sb.adminAuthenticated(header);

@ -71,7 +71,7 @@ public class ConfigLanguage_p {
//listManager.switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
String langPath = new File(env.getRootPath(), env.getConfig("locale.work", "DATA/LOCALE/locales")).toString();
String langPath = env.getConfigPath("locale.work", "DATA/LOCALE/locales").getAbsolutePath();
//Fallback
//prop.put("currentlang", ""); //is done by Translationtemplate

@ -78,7 +78,7 @@ public class ConfigSkins_p {
}
private static boolean changeSkin(plasmaSwitchboard sb, String skinPath, String skin){
File htdocsDir = new File(sb.getRootPath(), sb.getConfig("htDocsPath", "DATA/HTDOCS")+"/env");
File htdocsDir = new File(sb.getConfigPath("htDocsPath", "DATA/HTDOCS"), "env");
File styleFile = new File(htdocsDir, "style.css");
File skinFile = new File(skinPath, skin);
@ -93,7 +93,7 @@ public class ConfigSkins_p {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
serverObjects prop = new serverObjects();
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
String skinPath = new File(env.getRootPath(), env.getConfig("skinsPath", "DATA/SKINS")).toString();
String skinPath = new File(env.getRootPath(), env.getConfig("skinPath", "DATA/SKINS")).toString();
//Fallback
prop.put("currentskin", "");

@ -73,7 +73,7 @@ public class CrawlURLFetchStack_p {
public static URLFetcherStack getURLFetcherStack(serverSwitch env) {
if (stack == null) try {
stack = new URLFetcherStack(env.getConfig(plasmaSwitchboard.DBPATH, plasmaSwitchboard.DBPATH_DEFAULT));
stack = new URLFetcherStack(env.getConfigPath(plasmaSwitchboard.DBPATH, plasmaSwitchboard.DBPATH_DEFAULT));
} catch (IOException e) {
serverLog.logSevere("URLFETCHER", "Couldn't initialize URL stack: " + e.getMessage());
}

@ -114,7 +114,7 @@ public class Messages_p {
// first reset notification
File notifierSource = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot") + "/env/grafics/empty.gif");
File notifierDest = new File(switchboard.getConfig("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
File notifierDest = new File(switchboard.getConfigPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {

@ -95,15 +95,15 @@ public class ProxyIndexingMonitor_p {
// added proxyCache, proxyCacheSize - Borg-0300
// proxyCache - check and create the directory
oldProxyCachePath = env.getConfig("proxyCache", "DATA/HTCACHE");
newProxyCachePath = post.get("proxyCache", "DATA/HTCACHE");
oldProxyCachePath = env.getConfig(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT);
newProxyCachePath = post.get("proxyCache", plasmaSwitchboard.HTCACHE_PATH_DEFAULT);
newProxyCachePath = newProxyCachePath.replace('\\', '/');
if (newProxyCachePath.endsWith("/")) {
newProxyCachePath = newProxyCachePath.substring(0, newProxyCachePath.length() - 1);
}
final File cache = new File(newProxyCachePath);
env.setConfig(plasmaSwitchboard.HTCACHE_PATH, newProxyCachePath);
final File cache = env.getConfigPath(plasmaSwitchboard.HTCACHE_PATH, oldProxyCachePath);
if (!cache.isDirectory() && !cache.isFile()) cache.mkdirs();
env.setConfig("proxyCache", newProxyCachePath);
// proxyCacheSize
oldProxyCacheSize = getStringLong(env.getConfig("proxyCacheSize", "64"));
@ -169,7 +169,7 @@ public class ProxyIndexingMonitor_p {
prop.put("proxyIndexingRemote", env.getConfig("proxyIndexingRemote", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingLocalText", env.getConfig("proxyIndexingLocalText", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingLocalMedia", env.getConfig("proxyIndexingLocalMedia", "").equals("true") ? "1" : "0");
prop.put("proxyCache", env.getConfig("proxyCache", "DATA/HTCACHE"));
prop.put("proxyCache", env.getConfig(plasmaSwitchboard.HTCACHE_PATH, plasmaSwitchboard.HTCACHE_PATH_DEFAULT));
prop.put("proxyCacheSize", env.getConfig("proxyCacheSize", "64"));
// return rewrite properties
return prop;

@ -97,7 +97,7 @@ public class dir {
// variables for this path
// File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot"));
final File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
final File htroot = switchboard.getConfigPath("htDocsPath", "DATA/HTDOCS");
String path = (String) header.get("PATH", "/");
int pos = path.lastIndexOf("/");
if (pos >= 0) { path = path.substring(0, pos + 1); }

@ -47,6 +47,7 @@ package www;
// javac -classpath .:../classes index.java
// if the shell's current path is HTROOT
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
@ -83,10 +84,10 @@ public class welcome {
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));
if (senior) { prop.put("couldcan", "can"); } else { prop.put("couldcan", "could"); }
if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.putHTML("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); }
prop.putHTML("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
File wwwpath = env.getConfigPath("htDocsPath", "DATA/HTDOCS");
prop.putHTML("wwwpath", wwwpath.isAbsolute() ? wwwpath.getAbsolutePath() : "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
// return rewrite properties
return prop;
}
}

@ -79,7 +79,7 @@ public final class list {
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
final String col = post.get("col", "");
final File listsPath = new File(env.getRootPath(),env.getConfig("listsPath", "DATA/LISTS"));
final File listsPath = env.getConfigPath(plasmaSwitchboard.LISTS_PATH, plasmaSwitchboard.LISTS_PATH_DEFAULT);
String otherPeerName = null;
if (post.containsKey("iam")) {

@ -159,7 +159,7 @@ public final class message {
// finally write notification
File notifierSource = new File(sb.getRootPath(), sb.getConfig("htRootPath","htroot") + "/env/grafics/message.gif");
File notifierDest = new File(sb.getConfig("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
File notifierDest = new File(sb.getConfigPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {

@ -69,10 +69,8 @@ public class URLFetcherStack {
private int popped = 0;
private int pushed = 0;
public URLFetcherStack(String path) throws IOException {
this.db = new kelondroStack(
new File(path + File.separator + DBFILE),
rowdef);
public URLFetcherStack(File path) throws IOException {
this.db = new kelondroStack(new File(path, DBFILE), rowdef);
this.log = new serverLog("URLFETCHERSTACK");
}

@ -10,7 +10,7 @@
//
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy: $
// $LastChangedBy$
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -257,7 +257,7 @@ public class translator {
}
String htRootPath = env.getConfig("htRootPath", "htroot");
File sourceDir = new File(env.getRootPath(), htRootPath);
File destDir = new File(env.getConfig("locale.translated_html","DATA/LOCALE/htroot"), lang.substring(0, lang.length() - 4));// cut
File destDir = new File(env.getConfigPath("locale.translated_html","DATA/LOCALE/htroot"), lang.substring(0, lang.length() - 4));// cut
// .lng
//File destDir = new File(env.getRootPath(), htRootPath + "/locale/" + lang.substring(0, lang.length() - 4));// cut
// .lng

@ -182,21 +182,21 @@ public final class httpdFileHandler {
// create a htDocsPath: user defined pages
if (htDocsPath == null) {
htDocsPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "htdocs"));
htDocsPath = switchboard.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);
if (!(htDocsPath.exists())) htDocsPath.mkdir();
}
// create a htTemplatePath
if (htTemplatePath == null) {
htTemplatePath = new File(switchboard.getRootPath(), switchboard.getConfig("htTemplatePath","htroot/env/templates"));
htTemplatePath = switchboard.getConfigPath("htTemplatePath","htroot/env/templates");
if (!(htTemplatePath.exists())) htTemplatePath.mkdir();
}
//This is now handles by #%env/templates/foo%#
//if (templates.size() == 0) templates.putAll(httpTemplate.loadTemplates(htTemplatePath));
// create htLocaleDefault, htLocalePath
if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot"));
if (htLocalePath == null) htLocalePath = new File(switchboard.getConfig("locale.translated_html","DATA/LOCALE/htroot"));
if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath", "htroot");
if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");
}
}
@ -217,8 +217,8 @@ public final class httpdFileHandler {
* @param path relative from htroot
* @param localeSelection language of localized file; locale.language from switchboard is used if localeSelection.equals("") */
public static File getLocalizedFile(String path, String localeSelection){
if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot"));
if (htLocalePath == null) htLocalePath = new File(switchboard.getRootPath(), switchboard.getConfig("locale.translated_html","DATA/LOCALE/htroot"));
if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath","htroot");
if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html","DATA/LOCALE/htroot");
if (!(localeSelection.equals("default"))) {
File localePath = new File(htLocalePath, localeSelection + "/" + path);

@ -964,20 +964,20 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
long startedSeedListAquisition = System.currentTimeMillis();
// load values from configs
this.plasmaPath = new File(rootPath, getConfig(DBPATH, DBPATH_DEFAULT));
this.plasmaPath = getConfigPath(DBPATH, DBPATH_DEFAULT);
this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString());
this.indexPrimaryPath = new File(rootPath, getConfig(INDEX_PRIMARY_PATH, INDEX_PATH_DEFAULT));
this.indexPrimaryPath = getConfigPath(INDEX_PRIMARY_PATH, INDEX_PATH_DEFAULT);
this.log.logConfig("Index Primary Path: " + this.indexPrimaryPath.toString());
this.indexSecondaryPath = (getConfig(INDEX_SECONDARY_PATH, "").length() == 0) ? indexPrimaryPath : new File(getConfig(INDEX_SECONDARY_PATH, ""));
this.log.logConfig("Index Secondary Path: " + this.indexSecondaryPath.toString());
this.listsPath = new File(rootPath, getConfig(LISTS_PATH, LISTS_PATH_DEFAULT));
this.listsPath = getConfigPath(LISTS_PATH, LISTS_PATH_DEFAULT);
this.log.logConfig("Lists Path: " + this.listsPath.toString());
this.htDocsPath = new File(rootPath, getConfig(HTDOCS_PATH, HTDOCS_PATH_DEFAULT));
this.htDocsPath = getConfigPath(HTDOCS_PATH, HTDOCS_PATH_DEFAULT);
this.log.logConfig("HTDOCS Path: " + this.htDocsPath.toString());
this.rankingPath = new File(rootPath, getConfig(RANKING_PATH, RANKING_PATH_DEFAULT));
this.rankingPath = getConfigPath(RANKING_PATH, RANKING_PATH_DEFAULT);
this.log.logConfig("Ranking Path: " + this.rankingPath.toString());
this.rankingPermissions = new HashMap(); // mapping of permission - to filename.
this.workPath = new File(rootPath, getConfig(WORK_PATH, WORK_PATH_DEFAULT));
this.workPath = getConfigPath(WORK_PATH, WORK_PATH_DEFAULT);
this.log.logConfig("Work Path: " + this.workPath.toString());
// set up local robots.txt
@ -1002,7 +1002,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
// load the black-list / inspired by [AS]
File blacklistsPath = new File(getRootPath(), getConfig(LISTS_PATH, LISTS_PATH_DEFAULT));
File blacklistsPath = getConfigPath(LISTS_PATH, LISTS_PATH_DEFAULT);
String blacklistClassName = getConfig(BLACKLIST_CLASS, BLACKLIST_CLASS_DEFAULT);
this.log.logConfig("Starting blacklist engine ...");
@ -1099,14 +1099,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logConfig("Starting HT Cache Manager");
// create the cache directory
String cache = getConfig(HTCACHE_PATH, HTCACHE_PATH_DEFAULT);
cache = cache.replace('\\', '/');
if (cache.endsWith("/")) { cache = cache.substring(0, cache.length() - 1); }
if (new File(cache).isAbsolute()) {
htCachePath = new File(cache); // don't use rootPath
} else {
htCachePath = new File(rootPath, cache);
}
htCachePath = getConfigPath(HTCACHE_PATH, HTCACHE_PATH_DEFAULT);
this.log.logInfo("HTCACHE Path = " + htCachePath.getAbsolutePath());
long maxCacheSize = 1024 * 1024 * Long.parseLong(getConfig(PROXY_CACHE_SIZE, "2")); // this is megabyte
String cacheLayout = getConfig(PROXY_CACHE_LAYOUT, PROXY_CACHE_LAYOUT_TREE);
@ -1114,14 +1107,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
plasmaHTCache.init(htCachePath, maxCacheSize, ramHTTP_time, cacheLayout, cacheMigration);
// create the release download directory
String release = getConfig(RELEASE_PATH, RELEASE_PATH_DEFAULT);
release = release.replace('\\', '/');
if (release.endsWith("/")) { release = release.substring(0, release.length() - 1); }
if (new File(release).isAbsolute()) {
releasePath = new File(release); // don't use rootPath
} else {
releasePath = new File(rootPath, release);
}
releasePath = getConfigPath(RELEASE_PATH, RELEASE_PATH_DEFAULT);
releasePath.mkdirs();
this.log.logInfo("RELEASE Path = " + releasePath.getAbsolutePath());
@ -1235,7 +1221,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// init messages: clean up message symbol
File notifierSource = new File(getRootPath(), getConfig(HTROOT_PATH, HTROOT_PATH_DEFAULT) + "/env/grafics/empty.gif");
File notifierDest = new File(getConfig(HTDOCS_PATH, HTDOCS_PATH_DEFAULT), "notifier.gif");
File notifierDest = new File(getConfigPath(HTDOCS_PATH, HTDOCS_PATH_DEFAULT), "notifier.gif");
try {
serverFileUtils.copy(notifierSource, notifierDest);
} catch (IOException e) {
@ -2072,7 +2058,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* @return a new File instance
*/
public File getOwnSeedFile() {
return new File(getRootPath(), getConfig(OWN_SEED_FILE, DBFILE_OWN_SEED));
return getConfigPath(OWN_SEED_FILE, DBFILE_OWN_SEED);
}
/**

@ -210,12 +210,13 @@ public final class plasmaWordIndex implements indexRI {
}
private void flushCache(indexRAMRI ram, int count) {
if (count <= 0) return;
busyCacheFlush = true;
String wordHash;
ArrayList containerList = new ArrayList();
synchronized (ram) {
count = Math.min(5000, Math.min(count, ram.size()));
if (count <= 0) return;
boolean collectMax = true;
indexContainer c;
while (collectMax) {

@ -197,8 +197,12 @@ public final class serverLog {
logManager.readConfiguration(fileIn);
// creating the logging directory
File log = new File(homePath,"./DATA/LOG/");
if(!log.canRead()) log.mkdir();
String logPattern = logManager.getProperty("java.util.logging.FileHandler.pattern");
int stripPos = logPattern.lastIndexOf('/');
if (stripPos < 0) stripPos = logPattern.lastIndexOf(File.pathSeparatorChar);
File log = new File(logPattern.substring(0, stripPos));
if (!log.isAbsolute()) log = new File(homePath, log.getPath());
if (!log.canRead()) log.mkdir();
// TODO: changing the pattern settings for the file handlers

@ -318,6 +318,28 @@ public abstract class serverAbstractSwitch implements serverSwitch {
public boolean getConfigBool(String key, boolean dflt) {
return Boolean.valueOf(getConfig(key, Boolean.toString(dflt))).booleanValue();
}
/**
* Create a File instance for a configuration setting specifying a path.
* @param key config key
* @param dflt default path value, that is used when there is no value
* <code>key</code> in the configuration.
* @return if the value of the setting is an absolute path String, then the
* returned File is derived from this setting only. Otherwise the path's file
* is constructed from the applications root path + the relative path setting.
*/
public File getConfigPath(String key, String dflt) {
File ret;
String path = getConfig(key, dflt).replace('\\', '/');
File f = new File(path);
if (f == null) {
ret = null;
} else {
ret = (f.isAbsolute() ? f : new File(this.rootPath, path));
}
return ret;
}
public Iterator configKeys() {
return configProps.keySet().iterator();

@ -49,6 +49,7 @@
package de.anomic.server;
import java.io.File;
import java.net.InetAddress;
import java.util.Iterator;
import java.util.Map;
@ -102,6 +103,7 @@ public interface serverSwitch {
public String getConfig(String key, String dflt);
public long getConfigLong(String key, long dflt);
public boolean getConfigBool(String key, boolean dflt);
public File getConfigPath(String key, String dflt);
public Iterator configKeys();
public Map getRemoved();

@ -127,7 +127,7 @@ public class yacyCore {
log = new serverLog("YACY");
// create a yacy db
yacyDBPath = new File(sb.getRootPath(), sb.getConfig("yacyDB", "DATA/YACYDB"));
yacyDBPath = sb.getConfigPath("yacyDB", "DATA/YACYDB");
if (!yacyDBPath.exists()) { yacyDBPath.mkdir(); }
// create or init seed cache

@ -95,7 +95,7 @@ public class migration {
file.delete();
}
public static void installSkins(plasmaSwitchboard sb){
final File skinsPath = new File(sb.getRootPath(), sb.getConfig("skinsPath", "DATA/SKINS"));
final File skinsPath = sb.getConfigPath("skinPath", "DATA/SKINS");
final File defaultSkinsPath = new File(sb.getRootPath(), "skins");
if(defaultSkinsPath.exists()){
final String[] skinFiles = listManager.getDirListing(defaultSkinsPath.getAbsolutePath());
@ -112,9 +112,9 @@ public class migration {
if(skin.equals("")){
skin="default";
}
File skinsDir=new File(sb.getRootPath(), sb.getConfig("skinsPath", "DATA/SKINS"));
File skinsDir=sb.getConfigPath("skinPath", "DATA/SKINS");
File skinFile=new File(skinsDir, skin+".css");
File htdocsPath=new File(sb.getRootPath(), sb.getConfig("htdocsPath", "DATA/HTDOCS")+"/env");
File htdocsPath=new File(sb.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTROOT_PATH_DEFAULT), "env");
File styleFile=new File(htdocsPath, "style.css");
if(!skinFile.exists()){
if(styleFile.exists()){

@ -275,7 +275,7 @@ public final class yacy {
// create some directories
final File htRootPath = new File(homePath, sb.getConfig("htRootPath", "htroot"));
final File htDocsPath = new File(homePath, sb.getConfig("htDocsPath", "DATA/HTDOCS"));
final File htDocsPath = sb.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);
if (!(htDocsPath.exists())) htDocsPath.mkdir();
//final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
@ -343,8 +343,8 @@ public final class yacy {
}
// Copy the shipped locales into DATA, existing files are overwritten
final File locale_work = new File(homePath, sb.getConfig("locale.work", "DATA/LOCALE/locales"));
final File locale_source = new File(homePath, sb.getConfig("locale.source", "locales"));
final File locale_work = sb.getConfigPath("locale.work", "DATA/LOCALE/locales");
final File locale_source = sb.getConfigPath("locale.source", "locales");
try{
final File[] locale_source_files = locale_source.listFiles();
locale_work.mkdirs();
@ -366,7 +366,7 @@ public final class yacy {
if (!lang.equals("") && !lang.equals("default")) { //locale is used
String currentRev = "";
try{
final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(sb.getConfig("locale.translated_html", "DATA/LOCALE/htroot"), lang+"/version" ))));
final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(sb.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot"), lang+"/version" ))));
currentRev = br.readLine();
br.close();
}catch(IOException e){
@ -375,7 +375,7 @@ public final class yacy {
if (!currentRev.equals(sb.getConfig("svnRevision", ""))) try { //is this another version?!
final File sourceDir = new File(sb.getConfig("htRootPath", "htroot"));
final File destDir = new File(sb.getConfig("locale.translated_html", "DATA/LOCALE/htroot"), lang);
final File destDir = new File(sb.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot"), lang);
if (translator.translateFilesRecursive(sourceDir, destDir, new File(locale_work, lang + ".lng"), "html,template,inc", "locale")){ //translate it
//write the new Versionnumber
final BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(new File(destDir, "version"))));

@ -265,6 +265,9 @@ indexSecondaryPath=
# the path to the LISTS files. Most lists are used to filter web content
listsPath=DATA/LISTS
# path to additional databases, like messages, blog data and bookmarks
workPath=DATA/WORK
# the path to the SKINS files.
skinPath=DATA/SKINS

Loading…
Cancel
Save