Universal-Updater -> DarkStore Part 2

Renamed Strings For DarkStore
Made .store Files Useable
This commit is contained in:
dark98
2021-09-09 16:23:22 +01:00
parent 76b41884c5
commit c894ff9924
61 changed files with 650 additions and 648 deletions
+10 -8
View File
@@ -89,13 +89,13 @@ void getDirectoryContents(std::vector<DirEntry> &dirContents) {
}
/*
Return UniStore info.
Return Store info.
const std::string &file: Const Reference to the path of the file.
const std::string &fieName: Const Reference to the filename, without path.
*/
UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
UniStoreInfo Temp = { "", "", "", "", fileName, "", -1, -1, -1 }; // Title, Author, URL, File (to check if no slash exist), FileName, Desc, Version, Revision, entries.
StoreInfo GetInfo(const std::string &file, const std::string &fileName) {
StoreInfo Temp = { "", "", "", "", fileName, "", -1, -1, -1 }; // Title, Author, URL, File (to check if no slash exist), FileName, Desc, Version, Revision, entries.
if (fileName.length() > 4) {
if(*(u32*)(fileName.c_str() + fileName.length() - 4) == (1886349435 & ~(1 << 3))) return Temp;
@@ -147,23 +147,25 @@ UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
}
/*
Return UniStore info vector.
Return Store info vector.
const std::string &path: Const Reference to the path, where to check.
*/
std::vector<UniStoreInfo> GetUniStoreInfo(const std::string &path) {
std::vector<UniStoreInfo> info;
std::vector<StoreInfo> GetStoreInfo(const std::string &path) {
std::vector<StoreInfo> info;
std::vector<DirEntry> dirContents;
if (access(path.c_str(), F_OK) != 0) return {}; // Folder does not exist.
chdir(path.c_str());
getDirectoryContents(dirContents, { "unistore" });
getDirectoryContents(dirContents, { "store", "unistore" });
for(uint i = 0; i < dirContents.size(); i++) {
/* Make sure to ONLY push .unistores, and no folders. Avoids crashes in that case too. */
/* Make sure to ONLY push .store & .unistore, and no folders. Avoids crashes in that case too. */
if ((path + dirContents[i].name).find(".unistore") != std::string::npos) {
info.push_back( GetInfo(path + dirContents[i].name, dirContents[i].name) );
} else if ((path + dirContents[i].name).find(".store") != std::string::npos) {
info.push_back( GetInfo(path + dirContents[i].name, dirContents[i].name) );
}
}