1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
char homeF[512], getFilePath[512], getFileName[512], getFileTitle[512];
GetStringInfo("get_vdj_folder", &homeF[0], 512);
GetStringInfo("get_browsed_filepath", &getFilePath[0], 512);
GetStringInfo("get_browsed_artist", &getFileName[0], 512);
GetStringInfo("get_browsed_title", &getFileTitle[0], 512);
std::stringstream allPLs, makeSRFolder, makeATFolder;
// this is the root playlistfolder
allPLs << homeF << "\\playlists\\*.m3u";
makeSRFolder << homeF << "\\playlists\\search results\\";
makeATFolder << homeF << "\\playlists\\search results\\" << getFileName << "\\";
makeTTFolder << homeF << "\\playlists\\search results\\" << getFileName << "\\" << getFileTitle;
CreateDirectoryA(makeSRFolder.str().c_str(), NULL);
CreateDirectoryA(makeATFolder.str().c_str(), NULL);
CreateDirectoryA(makeTTFolder.str().c_str(), NULL);
_finddata_t data;
intptr_t ff = _findfirst(allPLs.str().c_str(), &data);
if (ff != -1)
{
int res = 0;
while (res != -1)
{
std::stringstream plName;
plName << homeF << "\\playlists\\" << data.name;
string line;
ifstream myfile(plName.str().c_str());
if (myfile.is_open())
{
while (getline(myfile, line))
{
if (line == getFilePath)
{
std::stringstream nplName;
nplName << homeF << "\\playlists\\search results\\" << getFileName << "\\" << getFileTitle << "\\" << data.name;
CopyFileA(plName.str().c_str(), nplName.str().c_str(), 0);
itWorked = 1;
myfile.close();
}
}
}
res = _findnext(ff, &data);
}
_findclose(ff);
}
| |