Skip to content

Commit

Permalink
Fixed a problem with 'Execute in Terminal' on OS X
Browse files Browse the repository at this point in the history
Tiled tried to create a temporary file in the current working directory, which
is not guaranteed to be a writable location. Now, the file will be created in
the folder for temporary files instead.
  • Loading branch information
bjorn committed Jan 8, 2016
1 parent b6d2a31 commit 2d1529a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tiled/command.cpp
Expand Up @@ -24,6 +24,7 @@
#include "mapdocument.h"
#include "mapobject.h"

#include <QDir>
#include <QMessageBox>
#include <QSettings>

Expand Down Expand Up @@ -100,7 +101,7 @@ CommandProcess::CommandProcess(const Command &command, bool inTerminal)
, mName(command.name)
, mFinalCommand(command.finalCommand())
#ifdef Q_OS_MAC
, mFile(QLatin1String("tiledXXXXXX.command"))
, mFile(QDir::tempPath() + QLatin1String("/tiledXXXXXX.command"))
#endif
{
// Give an error if the command is empty or just whitespace
Expand Down Expand Up @@ -132,7 +133,7 @@ CommandProcess::CommandProcess(const Command &command, bool inTerminal)
handleError(tr("Unable to create/open %1").arg(mFile.fileName()));
return;
}
mFile.write(mFinalCommand.toStdString().c_str());
mFile.write(mFinalCommand.toLocal8Bit());
mFile.close();

// Add execute permission to the file
Expand Down

0 comments on commit 2d1529a

Please sign in to comment.