mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
Add option to put 3DSX files in a folder
This commit is contained in:
@@ -51,6 +51,7 @@ bool ScriptUtils::matchPattern(const std::string &pattern, const std::string &te
|
||||
Result ScriptUtils::removeFile(const std::string &file, const std::string &message, bool isARG) {
|
||||
std::string out;
|
||||
out = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
out = std::regex_replace(out, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
out = std::regex_replace(out, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
|
||||
out = std::regex_replace(out, std::regex("%FIRM%"), config->firmPath());
|
||||
@@ -96,11 +97,13 @@ Result ScriptUtils::copyFile(const std::string &source, const std::string &desti
|
||||
|
||||
std::string _source, _dest;
|
||||
_source = std::regex_replace(source, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
_source = std::regex_replace(_source, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
_source = std::regex_replace(_source, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
_source = std::regex_replace(_source, std::regex("%NDS%"), config->ndsPath());
|
||||
_source = std::regex_replace(_source, std::regex("%FIRM%"), config->firmPath());
|
||||
|
||||
_dest = std::regex_replace(destination, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
_dest = std::regex_replace(_dest, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
_dest = std::regex_replace(_dest, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
_dest = std::regex_replace(_dest, std::regex("%NDS%"), config->ndsPath());
|
||||
_dest = std::regex_replace(_dest, std::regex("%FIRM%"), config->firmPath());
|
||||
@@ -138,11 +141,13 @@ Result ScriptUtils::renameFile(const std::string &oldName, const std::string &ne
|
||||
|
||||
std::string old, _new;
|
||||
old = std::regex_replace(oldName, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
old = std::regex_replace(old, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
old = std::regex_replace(old, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
old = std::regex_replace(old, std::regex("%NDS%"), config->ndsPath());
|
||||
old = std::regex_replace(old, std::regex("%FIRM%"), config->firmPath());
|
||||
|
||||
_new = std::regex_replace(newName, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
_new = std::regex_replace(_new, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
_new = std::regex_replace(_new, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
_new = std::regex_replace(_new, std::regex("%NDS%"), config->ndsPath());
|
||||
_new = std::regex_replace(_new, std::regex("%FIRM%"), config->firmPath());
|
||||
@@ -158,7 +163,8 @@ Result ScriptUtils::renameFile(const std::string &oldName, const std::string &ne
|
||||
/* Download from GitHub Release. */
|
||||
Result ScriptUtils::downloadRelease(const std::string &repo, const std::string &file, const std::string &output, bool includePrereleases, const std::string &message, bool isARG) {
|
||||
std::string out;
|
||||
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(output, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
out = std::regex_replace(out, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
|
||||
out = std::regex_replace(out, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
out = std::regex_replace(out, std::regex("%FIRM%"), config->firmPath());
|
||||
@@ -200,7 +206,8 @@ Result ScriptUtils::downloadRelease(const std::string &repo, const std::string &
|
||||
/* Download a file. */
|
||||
Result ScriptUtils::downloadFile(const std::string &file, const std::string &output, const std::string &message, bool isARG) {
|
||||
std::string out;
|
||||
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(output, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
out = std::regex_replace(out, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
|
||||
out = std::regex_replace(out, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
out = std::regex_replace(out, std::regex("%FIRM%"), config->firmPath());
|
||||
@@ -244,6 +251,7 @@ Result ScriptUtils::downloadFile(const std::string &file, const std::string &out
|
||||
void ScriptUtils::installFile(const std::string &file, bool updatingSelf, const std::string &message, bool isARG) {
|
||||
std::string in;
|
||||
in = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
in = std::regex_replace(in, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
in = std::regex_replace(in, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
in = std::regex_replace(in, std::regex("%NDS%"), config->ndsPath());
|
||||
in = std::regex_replace(in, std::regex("%FIRM%"), config->firmPath());
|
||||
@@ -273,10 +281,13 @@ void ScriptUtils::extractFile(const std::string &file, const std::string &input,
|
||||
|
||||
std::string out, in;
|
||||
in = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
in = std::regex_replace(in, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
in = std::regex_replace(in, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
in = std::regex_replace(in, std::regex("%NDS%"), config->ndsPath());
|
||||
in = std::regex_replace(in, std::regex("%FIRM%"), config->firmPath());
|
||||
|
||||
out = std::regex_replace(output, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
|
||||
out = std::regex_replace(out, std::regex("%3DSX%/(.*)\\.(.*)"), config->_3dsxPath() + (config->_3dsxInFolder() ? "/$1/$1.$2" : "/$1.$2"));
|
||||
out = std::regex_replace(out, std::regex("%3DSX%"), config->_3dsxPath());
|
||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
|
||||
out = std::regex_replace(out, std::regex("%FIRM%"), config->firmPath());
|
||||
|
||||
Reference in New Issue
Block a user