mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Work around crash in std::filesystem due to unexpected char encoding
This commit is contained in:
parent
2d035758f4
commit
94263cc7a0
|
|
@ -15,7 +15,6 @@
|
|||
#include "utility.hpp"
|
||||
#include "version.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QAction>
|
||||
#include <QDirIterator>
|
||||
|
|
@ -85,8 +84,8 @@ static void DisplayMissingDataDirWarning()
|
|||
"Please check installation instructions!\n\n"
|
||||
"Data most likely expected at:\n\n";
|
||||
#ifdef _WIN32
|
||||
msg += QString::fromStdString(
|
||||
(std::filesystem::current_path().string()));
|
||||
|
||||
msg += QDir::currentPath();
|
||||
msg += "/";
|
||||
#endif
|
||||
msg += obs_get_module_data_path(obs_current_module());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include <QLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <filesystem>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
@ -38,8 +37,8 @@ void FileSelection::SetPath(const QString &path)
|
|||
|
||||
QString FileSelection::ValidPathOrDesktop(const QString &path)
|
||||
{
|
||||
if (std::filesystem::exists(
|
||||
std::filesystem::path(path.toStdString()))) {
|
||||
QFileInfo fileInfo(path);
|
||||
if (fileInfo.isFile()) {
|
||||
return path;
|
||||
}
|
||||
return QStandardPaths::writableLocation(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "paramerter-wrappers.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <QFileInfo>
|
||||
#include <source-helpers.hpp>
|
||||
|
||||
namespace advss {
|
||||
|
|
@ -321,10 +321,12 @@ void OCRParameters::SetPageMode(tesseract::PageSegMode mode)
|
|||
|
||||
bool OCRParameters::SetLanguageCode(const std::string &value)
|
||||
{
|
||||
std::string dataPath = obs_get_module_data_path(obs_current_module()) +
|
||||
std::string("/res/ocr") + "/" + value +
|
||||
".traineddata";
|
||||
if (!std::filesystem::exists(dataPath)) {
|
||||
const auto dataPath =
|
||||
QString(obs_get_module_data_path(obs_current_module())) +
|
||||
QString("/res/ocr") + "/" + QString::fromStdString(value) +
|
||||
".traineddata";
|
||||
QFileInfo fileInfo(dataPath);
|
||||
if (!fileInfo.exists(dataPath)) {
|
||||
return false;
|
||||
}
|
||||
Setup();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user