|
a/src/common/rclconfig.cpp |
|
b/src/common/rclconfig.cpp |
|
... |
|
... |
1099 |
"# Values set in this file will override the system-wide values for the file\n"
|
1099 |
"# Values set in this file will override the system-wide values for the file\n"
|
1100 |
"# with the same name in the central directory. The syntax for setting\n"
|
1100 |
"# with the same name in the central directory. The syntax for setting\n"
|
1101 |
"# values is identical.\n"
|
1101 |
"# values is identical.\n"
|
1102 |
;
|
1102 |
;
|
1103 |
|
1103 |
|
|
|
1104 |
// Use uni2ascii -a K to generate these from the utf-8 strings
|
|
|
1105 |
// Swedish and Danish.
|
|
|
1106 |
static const char swedish_ex[] = "unac_except_trans = \303\244\303\244 \303\204\303\244 \303\266\303\266 \303\226\303\266 \303\274\303\274 \303\234\303\274 \303\237ss \305\223oe \305\222oe \303\246ae \303\206ae \357\254\201fi \357\254\202fl \303\245\303\245 \303\205\303\245";
|
|
|
1107 |
// German:
|
|
|
1108 |
static const char german_ex[] = "unac_except_trans = \303\244\303\244 \303\204\303\244 \303\266\303\266 \303\226\303\266 \303\274\303\274 \303\234\303\274 \303\237ss \305\223oe \305\222oe \303\246ae \303\206ae \357\254\201fi \357\254\202fl";
|
|
|
1109 |
|
1104 |
// Create initial user config by creating commented empty files
|
1110 |
// Create initial user config by creating commented empty files
|
1105 |
static const char *configfiles[] = {"recoll.conf", "mimemap", "mimeconf",
|
1111 |
static const char *configfiles[] = {"recoll.conf", "mimemap", "mimeconf",
|
1106 |
"mimeview"};
|
1112 |
"mimeview"};
|
1107 |
static int ncffiles = sizeof(configfiles) / sizeof(char *);
|
1113 |
static int ncffiles = sizeof(configfiles) / sizeof(char *);
|
1108 |
bool RclConfig::initUserConfig()
|
1114 |
bool RclConfig::initUserConfig()
|
|
... |
|
... |
1119 |
mkdir(m_confdir.c_str(), 0700) < 0) {
|
1125 |
mkdir(m_confdir.c_str(), 0700) < 0) {
|
1120 |
m_reason += string("mkdir(") + m_confdir + ") failed: " +
|
1126 |
m_reason += string("mkdir(") + m_confdir + ") failed: " +
|
1121 |
strerror(errno);
|
1127 |
strerror(errno);
|
1122 |
return false;
|
1128 |
return false;
|
1123 |
}
|
1129 |
}
|
|
|
1130 |
string lang = localelang();
|
1124 |
for (int i = 0; i < ncffiles; i++) {
|
1131 |
for (int i = 0; i < ncffiles; i++) {
|
1125 |
string dst = path_cat(m_confdir, string(configfiles[i]));
|
1132 |
string dst = path_cat(m_confdir, string(configfiles[i]));
|
1126 |
if (access(dst.c_str(), 0) < 0) {
|
1133 |
if (access(dst.c_str(), 0) < 0) {
|
1127 |
FILE *fp = fopen(dst.c_str(), "w");
|
1134 |
FILE *fp = fopen(dst.c_str(), "w");
|
1128 |
if (fp) {
|
1135 |
if (fp) {
|
1129 |
fprintf(fp, "%s\n", blurb);
|
1136 |
fprintf(fp, "%s\n", blurb);
|
|
|
1137 |
if (!strcmp(configfiles[i], "recoll.conf")) {
|
|
|
1138 |
// Add improved unac_except_trans for some languages
|
|
|
1139 |
if (lang == "se" || lang == "dk" || lang == "no" ||
|
|
|
1140 |
lang == "fi") {
|
|
|
1141 |
fprintf(fp, "%s\n", swedish_ex);
|
|
|
1142 |
} else if (lang == "de") {
|
|
|
1143 |
fprintf(fp, "%s\n", german_ex);
|
|
|
1144 |
}
|
|
|
1145 |
}
|
1130 |
fclose(fp);
|
1146 |
fclose(fp);
|
1131 |
} else {
|
1147 |
} else {
|
1132 |
m_reason += string("fopen ") + dst + ": " + strerror(errno);
|
1148 |
m_reason += string("fopen ") + dst + ": " + strerror(errno);
|
1133 |
return false;
|
1149 |
return false;
|
1134 |
}
|
1150 |
}
|