[TD]fix preference file handling

This commit is contained in:
Wanderer Fan
2022-06-03 12:19:03 -04:00
committed by WandererFan
parent b4c21869f2
commit 74085b609d
6 changed files with 61 additions and 33 deletions

View File

@@ -70,6 +70,7 @@
#include "HatchLine.h"
#include "DrawUtil.h"
#include "Preferences.h"
#include "Geometry.h"
#include "DrawPage.h"
#include "DrawViewPart.h"
@@ -615,19 +616,7 @@ void DrawGeomHatch::unsetupObject(void)
std::string DrawGeomHatch::prefGeomHatchFile(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/PAT/";
std::string defaultFileName = defaultDir + "FCPAT.pat";
std::string prefHatchFile = hGrp->GetASCII("FilePattern", defaultFileName.c_str());
std::string result = prefHatchFile;
Base::FileInfo fi(result);
if (!fi.isReadable()) {
result = defaultFileName;
Base::Console().Warning("Pat Hatch File: %s is not readable\n", prefHatchFile.c_str());
}
return result;
return Preferences::patFile();
}
std::string DrawGeomHatch::prefGeomHatchName()