Skip to content

Commit

Permalink
added execute arguments argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jackeri committed Dec 12, 2014
1 parent 40c35f9 commit 1c4e9d8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/UpdateInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ void UpdateInstaller::restartMainApp()
if (!m_executable.empty())
{
command = m_installDir + '/' + m_executable;
if (!m_executable_args.empty())
{
args.push_front(m_executable_args);
}
}
else
{
Expand Down Expand Up @@ -471,3 +475,7 @@ void UpdateInstaller::setExecutable(std::string& bin)
m_executable = bin;
}

void UpdateInstaller::setExecutableArgs(std::string& args)
{
m_executable_args = args;
}
2 changes: 2 additions & 0 deletions src/UpdateInstaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class UpdateInstaller
void setForceElevated(bool elevated);
void setAutoClose(bool autoClose);
void setExecutable(std::string& bin);
void setExecutableArgs(std::string& args);

void setObserver(UpdateObserver* observer);

Expand Down Expand Up @@ -68,5 +69,6 @@ class UpdateInstaller
bool m_forceElevated;
bool m_autoClose;
std::string m_executable;
std::string m_executable_args;
};

5 changes: 5 additions & 0 deletions src/UpdaterOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ void UpdaterOptions::parse(int argc, char** argv)
parser.setOption("wait");
parser.setOption("mode");
parser.setOption("execute");
parser.setOption("execute-args");
parser.setFlag("version");
parser.setFlag("force-elevated");
parser.setFlag("auto-close");
Expand Down Expand Up @@ -146,6 +147,10 @@ void UpdaterOptions::parse(int argc, char** argv)
{
executable = parser.getValue("execute");
}
if (parser.getValue("execute-args"))
{
executable_args = parser.getValue("execute-args");
}

showVersion = parser.getFlag("version");
forceElevated = parser.getFlag("force-elevated");
Expand Down
1 change: 1 addition & 0 deletions src/UpdaterOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class UpdaterOptions
std::string packageDir;
std::string scriptPath;
std::string executable;
std::string executable_args;
PLATFORM_PID waitPid;
std::string logFile;
bool showVersion;
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ int main(int argc, char** argv)
installer.setForceElevated(options.forceElevated);
installer.setAutoClose(options.autoClose);
installer.setExecutable(options.executable);
installer.setExecutableArgs(options.executable_args);

if (options.mode == UpdateInstaller::Main)
{
Expand Down

0 comments on commit 1c4e9d8

Please sign in to comment.