1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00
This commit is contained in:
Donkey 2020-09-07 20:53:45 +03:00 committed by GitHub
commit 125b22d89d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View file

@ -294,6 +294,7 @@ void XHTMLTagLinkAction::doAtStart(XHTMLReader &reader, const char **xmlattribut
std::string cssFilePath = reader.myPathPrefix + MiscUtil::decodeHtmlURL(href); std::string cssFilePath = reader.myPathPrefix + MiscUtil::decodeHtmlURL(href);
//ZLLogger::Instance().registerClass("CSS"); //ZLLogger::Instance().registerClass("CSS");
ZLLogger::Instance().println("CSS", "style file: " + cssFilePath); ZLLogger::Instance().println("CSS", "style file: " + cssFilePath);
cssFilePath = ZLStringUtil::replace(cssFilePath, ":", "/");
const ZLFile cssFile(cssFilePath); const ZLFile cssFile(cssFilePath);
cssFilePath = cssFile.path(); cssFilePath = cssFile.path();
shared_ptr<StyleSheetParserWithCache> parser = reader.myFileParsers[cssFilePath]; shared_ptr<StyleSheetParserWithCache> parser = reader.myFileParsers[cssFilePath];

View file

@ -37,6 +37,7 @@ ZLFile::ZLFile() : myMimeTypeIsUpToDate(true), myInfoIsFilled(true) {
} }
ZLFile::ZLFile(const std::string &path, const std::string &mimeType) : myPath(path), myMimeType(mimeType), myMimeTypeIsUpToDate(!mimeType.empty()), myInfoIsFilled(false) { ZLFile::ZLFile(const std::string &path, const std::string &mimeType) : myPath(path), myMimeType(mimeType), myMimeTypeIsUpToDate(!mimeType.empty()), myInfoIsFilled(false) {
myPath = ZLStringUtil::replace(myPath, ":./", ":");
ZLFSManager::Instance().normalize(myPath); ZLFSManager::Instance().normalize(myPath);
{ {
std::size_t index = ZLFSManager::Instance().findLastFileNameDelimiter(myPath); std::size_t index = ZLFSManager::Instance().findLastFileNameDelimiter(myPath);

View file

@ -80,6 +80,14 @@ void ZLStringUtil::append(std::string &str, const std::vector<std::string> &text
} }
} }
std::string ZLStringUtil::replace(std::string &str, const std::string &strSrc, const std::string &strDst){
std::string::size_type position= str.find(strSrc);
if (position != std::string::npos){
str.replace(position,strSrc.length(),strDst);
}
return str;
}
void ZLStringUtil::stripWhiteSpaces(std::string &str) { void ZLStringUtil::stripWhiteSpaces(std::string &str) {
std::size_t counter = 0; std::size_t counter = 0;
std::size_t length = str.length(); std::size_t length = str.length();

View file

@ -48,6 +48,8 @@ public:
static unsigned long parseHex(const std::string &str, int defaultValue); static unsigned long parseHex(const std::string &str, int defaultValue);
static void asciiToLowerInline(std::string &asciiString); static void asciiToLowerInline(std::string &asciiString);
static std::string replace(std::string &str, const std::string &strSrc, const std::string &strDst);
}; };
#endif /* __ZLSTRINGUTIL_H__ */ #endif /* __ZLSTRINGUTIL_H__ */