-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting the working directory for commands #941
Comments
Implementation is on the way. Questions:
|
One way would be to search the directories in
Why would you need this? You're supposed to set the working directory using |
I thought with |
That might very well be and depends on the behavior of xterm, but it's outside the scope of Tiled to resolve such an issue. |
Hmm, sorry, I just realized there is an "Execute in Terminal" option in the context menu, though it currently only shows up with Qt 4. I'll push a fix to bring it back for Qt 5. Edit: pushed in change a9292b5 |
@IMMZ I quickly checked, and the working directory of the process run with
So at least when using |
Any reason this wouldn't work for map path? (command.cpp) QString Command::finalCommand() const
{
QString finalCommand = command;
// Perform variable replacement
if (MapDocument *mapDocument = DocumentManager::instance()->currentDocument()) {
const QString fileName = mapDocument->fileName();
finalCommand.replace(QLatin1String("%mapfile"),
QString(QLatin1String("\"%1\"")).arg(fileName));
QFileInfo fileInfo(fileName);
QString mapPath = fileInfo.absolutePath();
finalCommand.replace(
QLatin1String("%mapPath"),
QString(QLatin1String("\"%1\"")).arg(mapPath));
//...
}
return finalCommand;
} |
Fair enough. I'll open a pull request with this then since it would be useful for running command scripts relative to the map / without absolute paths. |
@zcabjro Sure, looking forward to your pull request! Please keep in mind that the naming for variables has been all lower-case so far, contrary to the names I suggested in this issue, so you should make it |
A few years passed and I'm having the same problem as in #258 again. 😄 I feel like @bjorn What is the expected behavior of |
Hi @winniehell! This particular issue is under my proposal for GSoC '17, so I'll close this one within the next month. You can make any other suggestions here after going through my proposal once: Forum Link |
@ketanhwr That sounds great, thank you! 👍 |
@ketanhwr Yes, that's definitely useful. I think I've mentioned it before, since it also solves the problem that using the "Browse" button to choose the executable currently resets the command line arguments. |
Closed by f59b10c |
It would be nice if the working directory could be specified for the custom commands.
Suggested magic variables:
%executablePath
- the path of the executable that's supposed to be run%mapPath
- the path of the current map fileOriginally requested at issue #940.
The text was updated successfully, but these errors were encountered: