diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 9d4290506..8c056e30b 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -522,6 +522,12 @@ std::string Application::getUserAppDataDir() return mConfig["UserAppData"]; } +std::string Application::getUserMacroDir() +{ + std::string path("Macro/"); + return mConfig["UserAppData"] + path; +} + std::string Application::getResourceDir() { #ifdef RESOURCEDIR diff --git a/src/App/Application.h b/src/App/Application.h index 9b6048fd1..1fee610b4 100644 --- a/src/App/Application.h +++ b/src/App/Application.h @@ -247,6 +247,7 @@ public: static std::string getTempPath(); static std::string getTempFileName(const char* FileName=0); static std::string getUserAppDataDir(); + static std::string getUserMacroDir(); static std::string getResourceDir(); static std::string getHelpDir(); //@} @@ -301,7 +302,7 @@ private: static PyObject* sAddExportType (PyObject *self,PyObject *args,PyObject *kwd); static PyObject* sGetExportType (PyObject *self,PyObject *args,PyObject *kwd); static PyObject* sGetResourceDir (PyObject *self,PyObject *args,PyObject *kwd); - static PyObject* sGetUserAppDataDir (PyObject *self,PyObject *args,PyObject *kwd); + static PyObject* sGetUserAppDataDir (PyObject *self,PyObject *args,PyObject *kwd); static PyObject* sGetHomePath (PyObject *self,PyObject *args,PyObject *kwd); static PyObject* sLoadFile (PyObject *self,PyObject *args,PyObject *kwd); diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index f6c1e1b1b..7b2d6a0e9 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -722,7 +722,7 @@ void MacroCommand::activated(int iMsg) { std::string cMacroPath = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Macro")->GetASCII("MacroPath", - App::Application::getUserAppDataDir().c_str()); + App::Application::getUserMacroDir().c_str()); QDir d(QString::fromUtf8(cMacroPath.c_str())); QFileInfo fi(d, QString::fromUtf8(sScriptName)); diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/DlgActionsImp.cpp index 6bce69c4a..a3ec0d797 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/DlgActionsImp.cpp @@ -62,7 +62,7 @@ DlgCustomActionsImp::DlgCustomActionsImp( QWidget* parent ) // search for all macros std::string cMacroPath = App::GetApplication(). GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") - ->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str()); + ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); QDir d(QString::fromUtf8(cMacroPath.c_str()), QLatin1String("*.FCMacro *.py")); actionMacros->insertItems(0, d.entryList()); diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/DlgMacroExecuteImp.cpp index c056968be..8158f7f81 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/DlgMacroExecuteImp.cpp @@ -79,7 +79,7 @@ DlgMacroExecuteImp::DlgMacroExecuteImp( QWidget* parent, Qt::WindowFlags fl ) this->setupUi(this); // retrieve the macro path from parameter or use the user data as default std::string path = getWindowParameter()->GetASCII("MacroPath", - App::Application::getUserAppDataDir().c_str()); + App::Application::getUserMacroDir().c_str()); this->macroPath = QString::fromUtf8(path.c_str()); fileChooser->setFileName(this->macroPath); diff --git a/src/Gui/DlgMacroRecordImp.cpp b/src/Gui/DlgMacroRecordImp.cpp index cf90f1ddb..b273359a4 100644 --- a/src/Gui/DlgMacroRecordImp.cpp +++ b/src/Gui/DlgMacroRecordImp.cpp @@ -54,7 +54,7 @@ DlgMacroRecordImp::DlgMacroRecordImp( QWidget* parent, Qt::WindowFlags fl ) // get the macro home path this->macroPath = QString::fromUtf8(getWindowParameter()->GetASCII("MacroPath", - App::Application::getUserAppDataDir().c_str()).c_str()); + App::Application::getUserMacroDir().c_str()).c_str()); this->macroPath = QDir::toNativeSeparators(QDir(this->macroPath).path() + QDir::separator()); // set the edit fields diff --git a/src/Gui/DlgSettingsMacroImp.cpp b/src/Gui/DlgSettingsMacroImp.cpp index 2911540e1..496d56309 100644 --- a/src/Gui/DlgSettingsMacroImp.cpp +++ b/src/Gui/DlgSettingsMacroImp.cpp @@ -39,7 +39,7 @@ DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent ) { this->setupUi(this); if (MacroPath->fileName().isEmpty()) { - QDir d(QString::fromUtf8(App::GetApplication().getUserAppDataDir().c_str())); + QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str())); MacroPath->setFileName(d.path()); } } diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 63a42840f..a02c5df1e 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1196,7 +1196,7 @@ void PythonConsole::onClearConsole() void PythonConsole::onSaveHistoryAs() { QString cMacroPath = QString::fromUtf8(getDefaultParameter()->GetGroup( "Macro" )-> - GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str()).c_str()); + GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()).c_str()); QString fn = FileDialog::getSaveFileName(this, tr("Save History"), cMacroPath, QString::fromLatin1("%1 (*.FCMacro *.py)").arg(tr("Macro Files"))); if (!fn.isEmpty()) { diff --git a/src/Mod/Path/Gui/AppPathGuiPy.cpp b/src/Mod/Path/Gui/AppPathGuiPy.cpp index 154d9de23..a956ae58c 100644 --- a/src/Mod/Path/Gui/AppPathGuiPy.cpp +++ b/src/Mod/Path/Gui/AppPathGuiPy.cpp @@ -63,7 +63,7 @@ static PyObject * open(PyObject *self, PyObject *args) path += "Mod/Path/PathScripts/"; QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py")); std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") - ->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str()); + ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_pre.py")); QFileInfoList list = dir1.entryInfoList(); list << dir2.entryInfoList(); @@ -124,7 +124,7 @@ static PyObject * importer(PyObject *self, PyObject *args) path += "Mod/Path/PathScripts/"; QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py")); std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") - ->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str()); + ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_pre.py")); QFileInfoList list = dir1.entryInfoList(); list << dir2.entryInfoList(); @@ -194,7 +194,7 @@ static PyObject * exporter(PyObject *self, PyObject *args) path += "Mod/Path/PathScripts/"; QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_post.py")); std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") - ->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str()); + ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_post.py")); QFileInfoList list = dir1.entryInfoList(); list << dir2.entryInfoList();