Skip to content

Commit

Permalink
package's copy command has "clean" option (clean = delete before copy)
Browse files Browse the repository at this point in the history
  • Loading branch information
prophecy committed Jan 13, 2018
1 parent 826ada3 commit b9178a8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/wPackage/wPackage/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ void executeCommand(Value& commandCollection, Value& platformConf, string packag
if (subCommand.compare("-reverse_copy") == 0)
operMode = MODE_REVERSE_COPY;

bool isCopyCommand = command.compare("copy") == 0;

if (command.compare("copy") == 0 &&
(operMode == MODE_NORMAL || operMode == MODE_REVERSE_COPY)) {

Expand All @@ -198,6 +196,18 @@ void executeCommand(Value& commandCollection, Value& platformConf, string packag
break;
}

bool isClean = false;

if (commandCollection.HasMember("clean"))
isClean = string(commandCollection["clean"].GetString()).compare("true") == 0;

if (isClean) {

string cmd = string("rm -rf " + dstAbs);
cout << "clean cmd: " << cmd << endl;
cout << execute(cmd);
}

string cmd = string("cp -Rf ") + srcAbs + string(" ") + dstAbs;
cout << "cmd: " << cmd << endl;
string exeResult = execute(cmd);
Expand Down

0 comments on commit b9178a8

Please sign in to comment.