Skip to content

Commit

Permalink
Python: expand variables in app.saveProject and app.saveProjectAs
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Jul 11, 2021
1 parent 20f56dc commit b2cd4e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Fix Retina/High-DPI display issues on macOS, Windows and Linux/X11. #635
- Fix multi-dimensional parameter linking (bug introduced in 2.4.0 #594). #631
- Fix bug where any argument containing an integer between commas would be interpreted as a frame range. #644
- Python: `app.saveProject` and `app.saveProjectAs` now do project variable substitution, as in `app.saveProjectAs("[Variable]/output.ntp")`.

### Plugins

Expand All @@ -30,6 +31,7 @@
- Merge: Fix behavior on most operators when A is not connected or A's RoD and B's RoD are disjoint. #647
- Reformat: fix bugs when "turn" is checked with Resize Type = None or Type = Scale.


## Version 2.4.0

### Changes
Expand Down
14 changes: 12 additions & 2 deletions Engine/PyAppInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,23 @@ App::saveTempProject(const QString& filename)
bool
App::saveProject(const QString& filename)
{
return getInternalApp()->save( filename.toStdString() );
std::string outFile = filename.toStdString();
std::map<std::string, std::string> env;
getInternalApp()->getProject()->getEnvironmentVariables(env);
Project::expandVariable(env, outFile);

return getInternalApp()->save(outFile);
}

bool
App::saveProjectAs(const QString& filename)
{
return getInternalApp()->saveAs( filename.toStdString() );
std::string outFile = filename.toStdString();
std::map<std::string, std::string> env;
getInternalApp()->getProject()->getEnvironmentVariables(env);
Project::expandVariable(env, outFile);

return getInternalApp()->saveAs(outFile);
}

App*
Expand Down

0 comments on commit b2cd4e2

Please sign in to comment.