bumped: (0.1.5) moved slashing to regex.cpp
This commit is contained in:
parent
1171c40e7e
commit
3079cb8422
5 changed files with 24 additions and 18 deletions
2
PKGBUILD
2
PKGBUILD
|
@ -1,6 +1,6 @@
|
|||
pkgname=stc-git
|
||||
_gitname=stc
|
||||
pkgver=0.1.4
|
||||
pkgver=0.1.5
|
||||
pkgrel=1
|
||||
pkgdesc="Easily download collections and mods from steam."
|
||||
url="https://github.com/DRAGONTOS/stc"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "0.1.4"
|
||||
"version": "0.1.5"
|
||||
}
|
||||
|
|
|
@ -63,3 +63,15 @@ void Regex(cmd *inputCmd) {
|
|||
outputFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
void slashing(cmd *inputCmd) {
|
||||
//checks if a "\" is needed or not
|
||||
std::ifstream idscount{inputCmd->cacheid};
|
||||
|
||||
for (std::string line; std::getline(idscount, line); ) {
|
||||
inputCmd->step++;
|
||||
}
|
||||
|
||||
inputCmd->slash = (inputCmd->step == 2) ? R"( )": R"( \ )";
|
||||
idscount.close();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define REGEX_H
|
||||
#include <string>
|
||||
|
||||
// all the var's
|
||||
struct cmd {
|
||||
const char *userHome = getenv("HOME");
|
||||
|
||||
|
@ -17,8 +18,12 @@ std::string gameid;
|
|||
std::string dir;
|
||||
|
||||
int ab = 0;
|
||||
int step = 0;
|
||||
|
||||
std::string slash;
|
||||
};
|
||||
|
||||
// void Regex(const std::string& collectionid, const std::string& gameid, const std::string& cacheid, const std::string& cachesc);
|
||||
void Regex(cmd *inputCmd);
|
||||
void slashing(cmd *inputCmd);
|
||||
#endif
|
||||
|
|
19
src/main.cpp
19
src/main.cpp
|
@ -19,11 +19,10 @@ std::string woof(std::ifstream &meow) {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
|
||||
// struct cmd
|
||||
cmd inputCmd;
|
||||
inputCmd.dir = std::filesystem::current_path();
|
||||
|
||||
inputCmd.dir = std::filesystem::current_path();
|
||||
// Removes cache
|
||||
if (std::filesystem::exists(inputCmd.cacheid) &&
|
||||
std::filesystem::is_directory(inputCmd.cacheid)) {
|
||||
|
@ -164,27 +163,17 @@ int main(int argc, char **argv, char **envp) {
|
|||
|
||||
// regex function
|
||||
Regex(&inputCmd);
|
||||
|
||||
//checks if a "\" is needed or not
|
||||
std::ifstream idscount{inputCmd.cacheid};
|
||||
int step = 0;
|
||||
|
||||
for (std::string line; std::getline(idscount, line); ) {
|
||||
step++;
|
||||
}
|
||||
|
||||
std::string slash = (step == 2) ? R"( )": R"( \ )";
|
||||
idscount.close();
|
||||
slashing(&inputCmd);
|
||||
|
||||
//gets the ids
|
||||
std::ifstream ids{inputCmd.cacheid};
|
||||
std::string idsm = (inputCmd.ab == 1) ? R"( +workshop_download_item )" + inputCmd.gameid + " " + inputCmd.modid + " +quit": R"()";
|
||||
|
||||
// main command
|
||||
system(std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " + inputCmd.dir + " +login " + inputCmd.user + inputCmd.pass + slash + idsm + woof(ids)}.c_str());
|
||||
system(std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " + inputCmd.dir + " +login " + inputCmd.user + inputCmd.pass + inputCmd.slash + idsm + woof(ids)}.c_str());
|
||||
|
||||
// shows how much and what has downloaded
|
||||
std::string mods = (!inputCmd.modid.empty()) ? "" : R"(Mods: )" + std::to_string(step -1) + "\n";
|
||||
std::string mods = (!inputCmd.modid.empty()) ? "" : R"(Mods: )" + std::to_string(inputCmd.step -1) + "\n";
|
||||
std::string colm = (inputCmd.ab == 1) ? R"(Mod)": R"(Collection)";
|
||||
std::cout << "\n\n" + mods + colm + " has been downloaded too: " + inputCmd.dir + "\n";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue