Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Create a unique folder for each user.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19174 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Feb 18, 2014
1 parent 106c725 commit 85d3d91
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
18 changes: 11 additions & 7 deletions OMEdit/OMEditGUI/GUI/Dialogs/NotificationsDialog.cpp
Expand Up @@ -183,15 +183,17 @@ QString NotificationsDialog::getNotificationLabelString()
"It is highly recommended to delete the old OMEdit settings file. Click \"OK\" to delete.<br />"
"Contact us [OpenModelica@ida.liu.se] or Adeel Asghar [adeel.asghar@liu.se] with any comments, suggestions or problems.");
case NotificationsDialog::CrashReport:
#ifdef WIN32 // Win32
tmpPath = QDir::tempPath() + "/OpenModelica/OMEdit/";
tmpPath.remove("\"");
#ifdef WIN32 // Win32
OMCCommandsLogFilePath = QString("%1omeditcommands.log").arg(tmpPath);
OMCOutputFile = QString("%1openmodelica.omc.output.%2").arg(tmpPath).arg(Helper::OMCServerName);
stackTraceFile = QString("%1openmodelica.stacktrace.%2").arg(tmpPath).arg(Helper::OMCServerName);
OMCCommandsLogFilePath = QString("%1omeditcommands.log").arg(tmpPath);
OMCOutputFile = QString("%1openmodelica.omc.output.%2").arg(tmpPath).arg(Helper::OMCServerName);
stackTraceFile = QString("%1openmodelica.stacktrace.%2").arg(tmpPath).arg(Helper::OMCServerName);
#else // UNIX environment
user = getenv("USER");
if (!user) { user = "nobody"; }
tmpPath = QDir::tempPath() + "/OpenModelica_" + QString(user) + "/OMEdit/";
tmpPath.remove("\"");
OMCCommandsLogFilePath = QString("%1omeditcommands.%2.log").arg(tmpPath).arg(QString(user));
OMCOutputFile = QString("%1openmodelica.%2.omc.output.%3").arg(tmpPath).arg(QString(user)).arg(Helper::OMCServerName);
stackTraceFile = QString("%1openmodelica.%2.stacktrace.%3").arg(tmpPath).arg(QString(user)).arg(Helper::OMCServerName);
Expand Down Expand Up @@ -307,16 +309,18 @@ void NotificationsDialog::saveReleaseInformationNotificationSettings()
*/
void NotificationsDialog::sendCrashReport()
{
QString OMCCommandsLogFilePath, OMCOutputFile, stackTraceFile;
QString tmpPath = QDir::tempPath() + "/OpenModelica/OMEdit/";
tmpPath.remove("\"");
QString OMCCommandsLogFilePath, OMCOutputFile, stackTraceFile, tmpPath;
#ifdef WIN32 // Win32
tmpPath = QDir::tempPath() + "/OpenModelica/OMEdit/";
tmpPath.remove("\"");
OMCCommandsLogFilePath = QString("%1omeditcommands.log").arg(tmpPath);
OMCOutputFile = QString("%1openmodelica.omc.output.%2").arg(tmpPath).arg(Helper::OMCServerName);
stackTraceFile = QString("%1openmodelica.stacktrace.%2").arg(tmpPath).arg(Helper::OMCServerName);
#else // UNIX environment
char *user = getenv("USER");
if (!user) { user = "nobody"; }
tmpPath = QDir::tempPath() + "/OpenModelica_" + QString(user) + "/OMEdit/";
tmpPath.remove("\"");
OMCCommandsLogFilePath = QString("%1omeditcommands.%2.log").arg(tmpPath).arg(QString(user));
OMCOutputFile = QString("%1openmodelica.%2.omc.output.%3").arg(tmpPath).arg(QString(user)).arg(Helper::OMCServerName);
stackTraceFile = QString("%1openmodelica.%2.stacktrace.%3").arg(tmpPath).arg(QString(user)).arg(Helper::OMCServerName);
Expand Down
8 changes: 6 additions & 2 deletions OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -286,16 +286,20 @@ void OMCProxy::removeCachedOMCCommand(QString className)
bool OMCProxy::startServer()
{
/* create the tmp path */
#ifdef WIN32
QString tmpPath = QDir::tempPath() + "/OpenModelica/OMEdit/";
#else // UNIX environment
char *user = getenv("USER");
if (!user) { user = "nobody"; }
QString tmpPath = QDir::tempPath() + "/OpenModelica_" + QString(user) + "/OMEdit/";
#endif
tmpPath.remove("\"");
if (!QDir().exists(tmpPath))
QDir().mkpath(tmpPath);
/* create a file to write OMEdit commands log */
#ifdef WIN32
mCommandsLogFile.setFileName(QString("%1omeditcommands.log").arg(tmpPath));
#else // UNIX environment
char *user = getenv("USER");
if (!user) { user = "nobody"; }
mCommandsLogFile.setFileName(QString("%1omeditcommands.%3.log").arg(tmpPath).arg(QString(user)));
#endif
if (mCommandsLogFile.open(QIODevice::WriteOnly | QIODevice::Text))
Expand Down
3 changes: 2 additions & 1 deletion OMEdit/OMEditGUI/main.cpp
Expand Up @@ -117,7 +117,8 @@ void signalHandler(int signum)
QFile stackTraceFile;
char *user = getenv("USER");
if (!user) { user = "nobody"; }
stackTraceFile.setFileName(QString("%1/OpenModelica/OMEdit/openmodelica.%2.stacktrace.%3").arg(QDir::tempPath()).arg(QString(user)).arg(Helper::OMCServerName));
QString tmpPath = QDir::tempPath() + "/OpenModelica_" + QString(user) + "/OMEdit/";
stackTraceFile.setFileName(QString("%1openmodelica.%2.stacktrace.%3").arg(tmpPath).arg(QString(user)).arg(Helper::OMCServerName));
if (stackTraceFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
printStackTrace(&stackTraceFile, signum, name);
Expand Down

0 comments on commit 85d3d91

Please sign in to comment.