[TD] Fix win file spec backslash (fix #16646) (#16689)

* [TD]add method to clean win filespecs

- '\' in strings passed to Python as filespecs is interpreted as
  an escape of the following character.
- replace '\' with '/'

* [TD]remove '\' from filespecs before use
This commit is contained in:
WandererFan
2024-09-23 11:40:05 -04:00
committed by GitHub
parent 1ce5fca06b
commit c9beae7ef3
8 changed files with 58 additions and 20 deletions

View File

@@ -27,12 +27,14 @@
#include <App/Document.h>
#include <Base/Console.h>
#include <Base/Tools.h>
#include <Base/Vector3D.h>
#include <Gui/BitmapFactory.h>
#include <Gui/Command.h>
#include <Gui/ViewProvider.h>
#include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawView.h>
#include <Mod/TechDraw/App/DrawUtil.h>
#include "TaskGeomHatch.h"
#include "ui_TaskGeomHatch.h"
@@ -42,6 +44,7 @@
using namespace Gui;
using namespace TechDraw;
using namespace TechDrawGui;
using DU = DrawUtil;
TaskGeomHatch::TaskGeomHatch(TechDraw::DrawGeomHatch* inHatch, TechDrawGui::ViewProviderGeomHatch* inVp, bool mode) :
ui(new Ui_TaskGeomHatch),
@@ -91,7 +94,8 @@ void TaskGeomHatch::initUi()
void TaskGeomHatch::onFileChanged()
{
m_file = ui->fcFile->fileName().toUtf8().constData();
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
m_file = DU::cleanFilespecBackslash(filespec);
std::vector<std::string> names = PATLineSpec::getPatternList(m_file);
QStringList qsNames = listToQ(names);
ui->cbName->clear();