diff options
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | config.h.cmake | 1 | ||||
-rw-r--r-- | configure.in | 12 | ||||
-rw-r--r-- | po/cs.po | 5 | ||||
-rw-r--r-- | po/de.po | 5 | ||||
-rw-r--r-- | po/es.po | 5 | ||||
-rw-r--r-- | po/fr.po | 8 | ||||
-rw-r--r-- | po/hu.po | 5 | ||||
-rw-r--r-- | po/it.po | 5 | ||||
-rw-r--r-- | po/pl.po | 5 | ||||
-rw-r--r-- | po/pt_BR.po | 5 | ||||
-rw-r--r-- | po/ru.po | 5 | ||||
-rw-r--r-- | po/weechat.pot | 5 | ||||
-rw-r--r-- | src/core/weechat.c | 38 |
15 files changed, 95 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c8eb2eb63..ecb88d1b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,15 @@ OPTION(ENABLE_GUILE "Enable Scheme (guile) scripting language" ON) OPTION(ENABLE_XFER "Enable Xfer plugin" ON) OPTION(ENABLE_DOC "Enable Documentation" ON) +IF(NOT DEFINED WEECHAT_HOME OR "${WEECHAT_HOME}" STREQUAL "") + SET(WEECHAT_HOME "~/.weechat") +ENDIF(NOT DEFINED WEECHAT_HOME OR "${WEECHAT_HOME}" STREQUAL "") + +SET(WEECHAT_HOME "${WEECHAT_HOME}" CACHE + STRING "WeeChat home directory for config, logs, scripts.. (default is \"~/.weechat\")" + FORCE) +MARK_AS_ADVANCED(CLEAR WEECHAT_HOME) + IF(ENABLE_NLS) ADD_SUBDIRECTORY( po ) ENDIF(ENABLE_NLS) @@ -7,6 +7,8 @@ v0.3.7-dev, 2011-10-29 Version 0.3.7 (under dev!) -------------------------- +* core: add WEECHAT_HOME option in cmake and configure to setup default + WeeChat home (default is "~/.weechat") (task #11266) * core: add optional arguments for command /plugin load/reload/autoload * core: fix compilation error with "pid_t" on Mac OS X (bug #34639) * core: enable background process under Cygwin to connect to servers, fix diff --git a/config.h.cmake b/config.h.cmake index 1c1714e59..ea8047e80 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -30,4 +30,5 @@ #define WEECHAT_LIBDIR "@LIBDIR@" #define WEECHAT_SHAREDIR "@SHAREDIR@" #define LOCALEDIR "@LOCALEDIR@" +#define WEECHAT_HOME "@WEECHAT_HOME@" #define _GNU_SOURCE 1 diff --git a/configure.in b/configure.in index 81950d8eb..fe186c8ff 100644 --- a/configure.in +++ b/configure.in @@ -124,6 +124,7 @@ AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL]) AH_VERBATIM([PLUGIN_GUILE], [#undef PLUGIN_GUILE]) AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER]) AH_VERBATIM([DOC], [#undef DOC]) +AH_VERBATIM([WEECHAT_HOME], [#define WEECHAT_HOME "~/.weechat"]) # Arguments for ./configure @@ -158,6 +159,13 @@ AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR directory containing tcl AC_ARG_ENABLE(doc, [ --disable-doc turn off documentation (default=built)],enable_doc=$enableval,enable_doc=yes) AC_ARG_WITH(debug, [ --with-debug debugging: 0=no debug, 1=debug compilation (default=1)],debug=$withval,debug=1) +AC_ARG_VAR(WEECHAT_HOME, [WeeChat home directory for config, logs, scripts.. (default is "~/.weechat")]) + +if test "x$WEECHAT_HOME" = "x" ; then + WEECHAT_HOME="~/.weechat" +fi +AC_DEFINE_UNQUOTED(WEECHAT_HOME, "$WEECHAT_HOME") + not_asked="" not_found="" @@ -1223,7 +1231,9 @@ if test "x$not_asked" != "x" || test "x$not_found" != "x"; then fi echo "" -eval echo "WeeChat will be installed in $bindir." +echo "WeeChat home directory is ${WEECHAT_HOME}" +echo "" +eval echo "WeeChat will be installed in $bindir" echo "" echo "configure complete, now type 'make' to build WeeChat $VERSION" echo "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-22 12:21+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -88,6 +88,9 @@ msgstr "%s výchozí klávesy:\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Chyba: chybí argument pro volbu \"%s\"\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "Chyba: nemohu získat HOME adresář\n" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Nils Görs\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -96,6 +96,9 @@ msgstr "%s Standardtastenbelegungen (Kontext: \"%s\"):\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Fehler: fehlendes Argument für die Option \"%s\"\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "Fehler: Das HOME-Verzeichnis kann nicht ermittelt werden\n" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -89,6 +89,9 @@ msgstr "teclas por defecto de %s (contexto: \"%s\"):\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Error: falta un argumento para la opción \"%s\"\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "Error: no ha sido posible obtener el directorio HOME\n" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" -"PO-Revision-Date: 2011-10-29 11:39+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" +"PO-Revision-Date: 2011-10-29 16:49+0200\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: French\n" @@ -90,6 +90,10 @@ msgstr "Touches par défaut %s (contexte: \"%s\"):\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Erreur: paramètre manquant pour l'option \"%s\"\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" +"Erreur: WEECHAT_HOME n'est pas défini, vérifiez les options de construction\n" + msgid "Error: unable to get HOME directory\n" msgstr "Erreur: impossible de lire le répertoire personnel\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-22 12:21+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -84,6 +84,9 @@ msgstr "%s alapértelmezett billentyűk:\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + #, fuzzy msgid "Error: unable to get HOME directory\n" msgstr "%s nem sikerült a HOME könyvtárat beállítani\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -88,6 +88,9 @@ msgstr "%s tasti predefiniti (contesto: \"%s\"):\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Errore: argomento mancante per l'opzione \"%s\"\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "Errore: impossibile aprire la cartella HOME\n" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-27 11:56+0200\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -91,6 +91,9 @@ msgstr "%s domyślne skróty klawiszowe (kontekst: \"%s\"):\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Błąd: brak argumentu dla opcji \"%s\" \n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "Błąd: nie można pozyskać katalogu domowego\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 758159a85..f71088e4e 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-26 19:30+0200\n" "Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -112,6 +112,9 @@ msgstr "%s teclas de atalho padrão:\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "Error: faltando argumento para \"%s\" opção\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "Erro: incapaz de abrir o diretório padrão\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: 2011-10-22 12:21+0200\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -87,6 +87,9 @@ msgstr "%s клавиши по умолчанию:\n" msgid "Error: missing argument for \"%s\" option\n" msgstr "%s нет аргумента для параметра \"%s\"\n" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + #, fuzzy msgid "Error: unable to get HOME directory\n" msgstr "%s не могу получить домашний каталог\n" diff --git a/po/weechat.pot b/po/weechat.pot index d5e3ced62..37340d83a 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-10-29 11:38+0200\n" +"POT-Creation-Date: 2011-10-29 16:32+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -56,6 +56,9 @@ msgstr "" msgid "Error: missing argument for \"%s\" option\n" msgstr "" +msgid "Error: WEECHAT_HOME is undefined, check build options\n" +msgstr "" + msgid "Error: unable to get HOME directory\n" msgstr "" diff --git a/src/core/weechat.c b/src/core/weechat.c index 735fc15f7..d1cfb0ca2 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -282,23 +282,47 @@ weechat_parse_args (int argc, char *argv[]) void weechat_create_home_dirs () { - char *ptr_home; + char *ptr_home, *config_weechat_home = WEECHAT_HOME; int dir_length; struct stat statinfo; if (!weechat_home) { - ptr_home = getenv ("HOME"); - if (!ptr_home) + if (strlen (config_weechat_home) == 0) { string_iconv_fprintf (stderr, - _("Error: unable to get HOME directory\n")); + _("Error: WEECHAT_HOME is undefined, check " + "build options\n")); weechat_shutdown (EXIT_FAILURE, 0); /* make C static analyzer happy (never executed) */ return; } - dir_length = strlen (ptr_home) + 10; - weechat_home = malloc (dir_length); + + if (config_weechat_home[0] == '~') + { + /* replace leading '~' by $HOME */ + ptr_home = getenv ("HOME"); + if (!ptr_home) + { + string_iconv_fprintf (stderr, + _("Error: unable to get HOME directory\n")); + weechat_shutdown (EXIT_FAILURE, 0); + /* make C static analyzer happy (never executed) */ + return; + } + dir_length = strlen (ptr_home) + strlen (config_weechat_home + 1) + 1; + weechat_home = malloc (dir_length); + if (weechat_home) + { + snprintf (weechat_home, dir_length, + "%s%s", ptr_home, config_weechat_home + 1); + } + } + else + { + weechat_home = strdup (config_weechat_home); + } + if (!weechat_home) { string_iconv_fprintf (stderr, @@ -308,8 +332,6 @@ weechat_create_home_dirs () /* make C static analyzer happy (never executed) */ return; } - snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home, - DIR_SEPARATOR); } /* if home already exists, it has to be a directory */ |