mirror of
https://github.com/mrfluffy-dev/fsorter.git
synced 2026-01-17 02:50:33 +00:00
made Paths object and able to fill with values
This commit is contained in:
72
main.cpp
72
main.cpp
@@ -7,41 +7,26 @@
|
|||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
std::string settingsPath = "settings.conf";
|
std::string settingsPath = "settings.conf";
|
||||||
std::string musicPath()
|
class paths{
|
||||||
{
|
public:
|
||||||
std::string musicFolder = "";
|
std::string Picturs;
|
||||||
return musicFolder;
|
std::string Music;
|
||||||
}
|
std::string Vidios;
|
||||||
|
std::string Arcives;
|
||||||
|
};
|
||||||
|
|
||||||
std::string photoPath()
|
|
||||||
{
|
|
||||||
std::string photoFolder = "";
|
|
||||||
return photoFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string videoPath()
|
|
||||||
{
|
|
||||||
std::string videoFolder = "";
|
|
||||||
return videoFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string arcivePath()
|
|
||||||
{
|
|
||||||
std::string arciveFolder = "";
|
|
||||||
return arciveFolder;
|
|
||||||
}
|
|
||||||
void writeSettins()
|
void writeSettins()
|
||||||
{
|
{
|
||||||
std::ofstream settings(settingsPath);
|
std::ofstream settings(settingsPath);
|
||||||
settings << "Pictures=\n$HOME/Pictures" << std::endl;
|
settings << "Picture=\n$HOME/Pictures" << std::endl;
|
||||||
settings << "Music=\n$HOME/Music" << std::endl;
|
settings << "Music=\n$HOME/Music" << std::endl;
|
||||||
|
settings << "Video=\n$HOME/Videos" << std::endl;
|
||||||
|
settings << "Arcive=\n$HOME/Documents/Compressed" << std::endl;
|
||||||
settings.close();
|
settings.close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> readSettings()
|
std::vector<std::string> readSettings()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::ifstream settings(settingsPath);
|
std::ifstream settings(settingsPath);
|
||||||
std::vector<std::string> listOfPaths;
|
std::vector<std::string> listOfPaths;
|
||||||
std::string setting;
|
std::string setting;
|
||||||
@@ -59,14 +44,37 @@ std::vector<std::string> readSettings()
|
|||||||
}
|
}
|
||||||
return listOfPaths;
|
return listOfPaths;
|
||||||
}
|
}
|
||||||
|
paths declarePaths(std::vector<std::string> listOfPaths)
|
||||||
|
{
|
||||||
|
paths Paths;
|
||||||
|
for (int i = 0; i < listOfPaths.size(); i+=2)
|
||||||
|
{
|
||||||
|
listOfPaths[i].pop_back();
|
||||||
|
std::string type = listOfPaths[i];
|
||||||
|
std::string path = listOfPaths[i+1];
|
||||||
|
if(type == "Picture")
|
||||||
|
{
|
||||||
|
Paths.Picturs = path;
|
||||||
|
}
|
||||||
|
else if (type == "Music")
|
||||||
|
{
|
||||||
|
Paths.Music = path;
|
||||||
|
}
|
||||||
|
else if (type == "Video")
|
||||||
|
{
|
||||||
|
Paths.Vidios = path;
|
||||||
|
}
|
||||||
|
else if (type == "Arcive")
|
||||||
|
{
|
||||||
|
Paths.Arcives = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Paths;
|
||||||
|
}
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::vector<std::string> listOfPaths = readSettings();
|
std::vector<std::string> listOfPaths = readSettings();
|
||||||
for (int i; i < listOfPaths.size(); i++) {
|
paths Paths = declarePaths(listOfPaths);
|
||||||
std::string stringItem ="echo " + listOfPaths[1];
|
std::cout << Paths.Picturs << std::endl;
|
||||||
const char* item = stringItem.c_str();
|
|
||||||
system(item);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user