feat: treat .md files as .txt (#498)
## Summary * Quick fix for markdown reading - open them as txt files
This commit is contained in:
parent
5d369df6be
commit
0bc0baa966
@ -120,7 +120,8 @@ void MyLibraryActivity::loadFiles() {
|
|||||||
} else {
|
} else {
|
||||||
auto filename = std::string(name);
|
auto filename = std::string(name);
|
||||||
if (StringUtils::checkFileExtension(filename, ".epub") || StringUtils::checkFileExtension(filename, ".xtch") ||
|
if (StringUtils::checkFileExtension(filename, ".epub") || StringUtils::checkFileExtension(filename, ".xtch") ||
|
||||||
StringUtils::checkFileExtension(filename, ".xtc") || StringUtils::checkFileExtension(filename, ".txt")) {
|
StringUtils::checkFileExtension(filename, ".xtc") || StringUtils::checkFileExtension(filename, ".txt") ||
|
||||||
|
StringUtils::checkFileExtension(filename, ".md")) {
|
||||||
files.emplace_back(filename);
|
files.emplace_back(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,8 @@ bool ReaderActivity::isXtcFile(const std::string& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ReaderActivity::isTxtFile(const std::string& path) {
|
bool ReaderActivity::isTxtFile(const std::string& path) {
|
||||||
if (path.length() < 4) return false;
|
return StringUtils::checkFileExtension(path, ".txt") ||
|
||||||
std::string ext4 = path.substr(path.length() - 4);
|
StringUtils::checkFileExtension(path, ".md"); // Treat .md as txt files (until we have a markdown reader)
|
||||||
return ext4 == ".txt" || ext4 == ".TXT";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Epub> ReaderActivity::loadEpub(const std::string& path) {
|
std::unique_ptr<Epub> ReaderActivity::loadEpub(const std::string& path) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user