|
a/src/httpfs.cxx |
|
b/src/httpfs.cxx |
|
... |
|
... |
146 |
* protocol info data
|
146 |
* protocol info data
|
147 |
*
|
147 |
*
|
148 |
* We strip white-space from beginning/ends of lines, and allow
|
148 |
* We strip white-space from beginning/ends of lines, and allow
|
149 |
* #-started comments (on a line alone only, comments after data not allowed).
|
149 |
* #-started comments (on a line alone only, comments after data not allowed).
|
150 |
*/
|
150 |
*/
|
151 |
static bool read_protocolinfo(const string& fn, string& out)
|
151 |
static bool read_protocolinfo(const string& fn, bool enableL16, string& out)
|
152 |
{
|
152 |
{
|
153 |
ifstream input;
|
153 |
ifstream input;
|
154 |
input.open(fn, ios::in);
|
154 |
input.open(fn, ios::in);
|
155 |
if (!input.is_open()) {
|
155 |
if (!input.is_open()) {
|
156 |
return false;
|
156 |
return false;
|
|
... |
|
... |
167 |
// must be processed. This happens if the last line before
|
167 |
// must be processed. This happens if the last line before
|
168 |
// eof ends with a backslash, or there is no final \n
|
168 |
// eof ends with a backslash, or there is no final \n
|
169 |
eof = true;
|
169 |
eof = true;
|
170 |
}
|
170 |
}
|
171 |
trimstring(line, " \t\n\r");
|
171 |
trimstring(line, " \t\n\r");
|
|
|
172 |
if (enableL16 && line[0] == '@') {
|
|
|
173 |
line = regsub1("@ENABLEL16@", line, "");
|
|
|
174 |
} else {
|
|
|
175 |
line = regsub1("@ENABLEL16@", line, "#");
|
|
|
176 |
}
|
172 |
if (line[0] == '#')
|
177 |
if (line[0] == '#')
|
173 |
continue;
|
178 |
continue;
|
174 |
out += line;
|
179 |
out += line;
|
175 |
if (eof)
|
180 |
if (eof)
|
176 |
break;
|
181 |
break;
|
|
... |
|
... |
183 |
// virtual directory
|
188 |
// virtual directory
|
184 |
bool initHttpFs(unordered_map<string, VDirContent>& files,
|
189 |
bool initHttpFs(unordered_map<string, VDirContent>& files,
|
185 |
const string& datadir,
|
190 |
const string& datadir,
|
186 |
const string& UUID, const string& friendlyname,
|
191 |
const string& UUID, const string& friendlyname,
|
187 |
bool enableAV, bool enableOH, bool enableReceiver,
|
192 |
bool enableAV, bool enableOH, bool enableReceiver,
|
|
|
193 |
bool enableL16,
|
188 |
const string& iconpath, const string& presentationhtml)
|
194 |
const string& iconpath, const string& presentationhtml)
|
189 |
{
|
195 |
{
|
190 |
if (enableOH) {
|
196 |
if (enableOH) {
|
191 |
if (enableReceiver) {
|
197 |
if (enableReceiver) {
|
192 |
ohxmlfilenames.push_back("OHReceiver.xml");
|
198 |
ohxmlfilenames.push_back("OHReceiver.xml");
|
|
... |
|
... |
194 |
xmlfilenames.insert(xmlfilenames.end(), ohxmlfilenames.begin(),
|
200 |
xmlfilenames.insert(xmlfilenames.end(), ohxmlfilenames.begin(),
|
195 |
ohxmlfilenames.end());
|
201 |
ohxmlfilenames.end());
|
196 |
}
|
202 |
}
|
197 |
|
203 |
|
198 |
string protofile(path_cat(datadir, "protocolinfo.txt"));
|
204 |
string protofile(path_cat(datadir, "protocolinfo.txt"));
|
199 |
if (!read_protocolinfo(protofile, g_protocolInfo)) {
|
205 |
if (!read_protocolinfo(protofile, enableL16, g_protocolInfo)) {
|
200 |
LOGFAT("Failed reading protocol info from " << protofile << endl);
|
206 |
LOGFAT("Failed reading protocol info from " << protofile << endl);
|
201 |
return false;
|
207 |
return false;
|
202 |
}
|
208 |
}
|
203 |
protocolInfoToFormats(g_protocolInfo, g_supportedFormats);
|
209 |
protocolInfoToFormats(g_protocolInfo, g_supportedFormats);
|
204 |
|
210 |
|