mirror of
https://github.com/mrfluffy-dev/fsorter.git
synced 2026-01-17 02:50:33 +00:00
added -i flag to ignor file tipes from sorting
This commit is contained in:
27
main.cpp
Normal file → Executable file
27
main.cpp
Normal file → Executable file
@@ -45,7 +45,7 @@ void writeSettins()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Reads all the lines in settings.toml and saves them in a vector line by line.
|
//Reads all the lines in settings.toml and saves them in a vector line by line.
|
||||||
std::vector<typeAndPaths> readSettings()
|
std::vector<typeAndPaths> readSettings(std::vector<std::string> ignoreList)
|
||||||
{
|
{
|
||||||
std::vector<typeAndPaths> paths;
|
std::vector<typeAndPaths> paths;
|
||||||
typeAndPaths Paths;
|
typeAndPaths Paths;
|
||||||
@@ -78,6 +78,17 @@ std::vector<typeAndPaths> readSettings()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
for(auto it = tbl.begin(); it != tbl.end(); ++it)
|
for(auto it = tbl.begin(); it != tbl.end(); ++it)
|
||||||
|
{
|
||||||
|
std::cout << ignoreList.size() << std::endl;
|
||||||
|
bool allow = true;
|
||||||
|
for (int e = 0; e < ignoreList.size(); e++) {
|
||||||
|
if (ignoreList[e] == std::string(it->first))
|
||||||
|
{
|
||||||
|
allow = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allow == true)
|
||||||
{
|
{
|
||||||
Paths.type = it->first;
|
Paths.type = it->first;
|
||||||
Paths.path = tbl[it->first]["path"].ref<std::string>();
|
Paths.path = tbl[it->first]["path"].ref<std::string>();
|
||||||
@@ -91,6 +102,7 @@ std::vector<typeAndPaths> readSettings()
|
|||||||
paths.push_back(Paths);
|
paths.push_back(Paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
settingsFile.close();
|
settingsFile.close();
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
@@ -153,10 +165,19 @@ void sortPath(std::string path, std::vector<typeAndPaths> Paths)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
std::vector<typeAndPaths> TypesAndPaths = readSettings();
|
int i = 0;
|
||||||
|
std::vector<std::string> ignoreList;
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (std::string(argv[i]) == "-i") {
|
||||||
|
ignoreList.push_back(argv[i+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<typeAndPaths> TypesAndPaths = readSettings(ignoreList);
|
||||||
checkSettingsPaths(TypesAndPaths);
|
checkSettingsPaths(TypesAndPaths);
|
||||||
sortPath(sortingPath, TypesAndPaths);
|
sortPath(sortingPath, TypesAndPaths);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user