From 01480a174a311dd9d8567a4378f4137eb17461e5 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 20 Apr 2015 12:45:43 -0300 Subject: [PATCH] Workaround for issue #1963 - Search for templates in userAppData/Templates folder --- src/Mod/Drawing/App/FeaturePage.cpp | 7 ++++++- src/Mod/Raytracing/App/LuxProject.cpp | 7 ++++++- src/Mod/Raytracing/App/RayProject.cpp | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Mod/Drawing/App/FeaturePage.cpp b/src/Mod/Drawing/App/FeaturePage.cpp index 3d5efa956..85cef73c1 100644 --- a/src/Mod/Drawing/App/FeaturePage.cpp +++ b/src/Mod/Drawing/App/FeaturePage.cpp @@ -107,7 +107,12 @@ void FeaturePage::onChanged(const App::Property* prop) void FeaturePage::onDocumentRestored() { Base::FileInfo fi(PageResult.getValue()); - Template.setValue(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName()); + std::string path = App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName(); + // try to find the template in user dir/Templates first + Base::FileInfo tempfi(App::Application::getUserAppDataDir() + "Templates/" + fi.fileName()); + if (tempfi.exists()) + path = tempfi.filePath(); + Template.setValue(path); } App::DocumentObjectExecReturn *FeaturePage::execute(void) diff --git a/src/Mod/Raytracing/App/LuxProject.cpp b/src/Mod/Raytracing/App/LuxProject.cpp index 43e31a582..fde32dce9 100644 --- a/src/Mod/Raytracing/App/LuxProject.cpp +++ b/src/Mod/Raytracing/App/LuxProject.cpp @@ -54,7 +54,12 @@ LuxProject::LuxProject(void) void LuxProject::onDocumentRestored() { Base::FileInfo fi(PageResult.getValue()); - Template.setValue(App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName()); + std::string path = App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName(); + // try to find the template in user dir/Templates first + Base::FileInfo tempfi(App::Application::getUserAppDataDir() + "Templates/" + fi.fileName()); + if (tempfi.exists()) + path = tempfi.filePath(); + Template.setValue(path); } App::DocumentObjectExecReturn *LuxProject::execute(void) diff --git a/src/Mod/Raytracing/App/RayProject.cpp b/src/Mod/Raytracing/App/RayProject.cpp index a73b0f4f2..d4f1428e7 100644 --- a/src/Mod/Raytracing/App/RayProject.cpp +++ b/src/Mod/Raytracing/App/RayProject.cpp @@ -53,7 +53,12 @@ RayProject::RayProject(void) void RayProject::onDocumentRestored() { Base::FileInfo fi(PageResult.getValue()); - Template.setValue(App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName()); + std::string path = App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName(); + // try to find the template in user dir/Templates first + Base::FileInfo tempfi(App::Application::getUserAppDataDir() + "Templates/" + fi.fileName()); + if (tempfi.exists()) + path = tempfi.filePath(); + Template.setValue(path); } App::DocumentObjectExecReturn *RayProject::execute(void)