Workaround for issue #1963 - Search for templates in userAppData/Templates folder

This commit is contained in:
Yorik van Havre 2015-04-20 12:45:43 -03:00
parent 01768b70e7
commit 01480a174a
3 changed files with 18 additions and 3 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)