Forgotten files in windows path insensitivity commit
This commit is contained in:
parent
08a3bd926c
commit
723497b7a0
2 changed files with 40 additions and 0 deletions
24
src/common/utf8fn.cpp
Normal file
24
src/common/utf8fn.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "utf8fn.h"
|
||||
#include "rclconfig.h"
|
||||
#include "transcode.h"
|
||||
#include "log.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
string compute_utf8fn(const RclConfig *config, const string& ifn, bool simple)
|
||||
{
|
||||
string charset = config->getDefCharset(true);
|
||||
string utf8fn;
|
||||
int ercnt;
|
||||
string lfn(simple ? path_getsimple(ifn) : ifn);
|
||||
if (!transcode(lfn, utf8fn, charset, "UTF-8", &ercnt)) {
|
||||
LOGERR("compute_utf8fn: fn transcode failure from [" << charset <<
|
||||
"] to UTF-8 for: [" << lfn << "]\n");
|
||||
} else if (ercnt) {
|
||||
LOGDEB("compute_utf8fn: " << ercnt << " transcode errors from [" <<
|
||||
charset << "] to UTF-8 for: [" << lfn << "]\n");
|
||||
}
|
||||
LOGDEB1("compute_utf8fn: transcoded from [" << lfn << "] to [" <<
|
||||
utf8fn << "] (" << charset << "->" << "UTF-8)\n");
|
||||
return utf8fn;
|
||||
}
|
16
src/common/utf8fn.h
Normal file
16
src/common/utf8fn.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef _UTF8FN_H_
|
||||
#define _UTF8FN_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class RclConfig;
|
||||
|
||||
// Translate file name/path to utf8 for indexing.
|
||||
//
|
||||
// @param simple If true we extract and process only the simple file name
|
||||
// (ignore the path)
|
||||
std::string compute_utf8fn(const RclConfig *config, const std::string& ifn,
|
||||
bool simple);
|
||||
|
||||
#endif // _UTF8FN_H_
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue