You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.6 KiB
48 lines
1.6 KiB
#include <array>
|
|
#include <string_view>
|
|
#include <filesystem>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
using namespace std::literals;
|
|
|
|
int main(){
|
|
const std::string_view baseDir{"C:/Users/sigon/OneDrive/Documents/"};
|
|
const std::vector<std::string_view>directories{
|
|
"15gays1pack",
|
|
"Egg Carton 2",
|
|
};
|
|
for(const std::string_view&dir:directories){
|
|
std::string directory{std::string(baseDir)+std::string(dir)};
|
|
for(auto const&songDir:std::filesystem::directory_iterator(directory)){
|
|
if(songDir.is_directory()){
|
|
for(auto const&file:std::filesystem::directory_iterator(songDir)){
|
|
if(file.is_regular_file()&&(file.path().string().ends_with(".ssc")||file.path().string().ends_with(".sm")||file.path().string().ends_with(".smc"))){
|
|
std::ifstream stepchartFile{file.path().string()};
|
|
std::string fileContents;
|
|
std::string_view titleLineView;
|
|
while(stepchartFile.good()){
|
|
std::string line;
|
|
int cursor{stepchartFile.cur};
|
|
std::getline(stepchartFile,line);
|
|
if(line.starts_with("#TITLE:")){
|
|
std::string titleLine{line.substr("#TITLE:"s.length())};
|
|
titleLineView=titleLine;
|
|
titleLineView.remove_suffix(1);
|
|
std::cout<<"Title Found: "<<titleLineView<<std::endl;
|
|
fileContents+=std::format("#TITLE:[{}] {};\n",dir,titleLineView);
|
|
}else{
|
|
fileContents+=line+"\n";
|
|
}
|
|
}
|
|
stepchartFile.close();
|
|
std::ofstream stepchartFileOut{file.path().string()};
|
|
stepchartFileOut.write(fileContents.c_str(),fileContents.length());
|
|
std::cout<<"Rewritten Chart "<<titleLineView<<"!"<<std::endl;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
} |