bug fixes
This commit is contained in:
parent
0fa6d6b056
commit
af3af6bc4f
1 changed files with 52 additions and 28 deletions
80
main.cpp
80
main.cpp
|
|
@ -5,6 +5,14 @@
|
|||
|
||||
#define IMGUI_IMPLEMENTATION
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
#define log_debugc(str, ...) do { if (debug) fprintf(stdout, "[DEBUG] (%s:%d): " (str) "\n", __FILE__, __LINE__, ##__VA_ARGS__); } while (0)
|
||||
#define log_debugcpp(str) do { \
|
||||
if (debug) std::cout << "[DEBUG]" << "(" << __FILE__ << ":" << __LINE__ << "): " << (str) << std::endl; \
|
||||
} while (0)
|
||||
#define log_directory(str) if(debugVerbosity & DEBUG_DIRECTORY) log_debugcpp((str))
|
||||
#define log_volume(str) if(debugVerbosity & DEBUG_VOLUME) log_debugcpp((str))
|
||||
#define log_extension(str) if(debugVerbosity & DEBUG_EXTENSION) log_debugcpp((str))
|
||||
|
||||
#include "imgui/misc/single_file/imgui_single_file.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
|
@ -25,6 +33,17 @@ static void glfw_error_callback(int error, const char* description)
|
|||
|
||||
bool debug = true;
|
||||
|
||||
// int debugVerbosity = 0;
|
||||
// enum enumDebugVerbosity {
|
||||
// DEBUG_DIRECTORY = (1<<0),
|
||||
// DEBUG_VOLUME = (1<<1),
|
||||
// DEBUG_EXTENSION = (1<<2)
|
||||
// };
|
||||
// debugVerbosity = DEBUG_DIRECTORY | DEBUG_EXTENSION;
|
||||
// debugVerbosity &= ~DEBUG_DIRECTORY;
|
||||
// if (debugVerbosity & (DEBUG_DIRECTORY | DEBUG_EXTENSION));
|
||||
|
||||
|
||||
typedef struct {
|
||||
std::vector<uint64_t> size;
|
||||
std::vector<char*> name;
|
||||
|
|
@ -165,7 +184,6 @@ int listVolumes(std::vector<char*> *onPresentPaths){
|
|||
int volumePathsBufferSize = (MAX_PATH + 1) * sizeof(TCHAR);
|
||||
unsigned long volumePathLength;
|
||||
TCHAR volumePaths[volumePathsBufferSize];
|
||||
//TODO necesario? di
|
||||
std::fill(volumePaths, volumePaths + volumePathsBufferSize, '\0');
|
||||
|
||||
hFind = FindFirstVolume(volumeName, volumeNameSize); //if (debug) std::cout << volumeNameSize << std::endl;
|
||||
|
|
@ -177,27 +195,26 @@ int listVolumes(std::vector<char*> *onPresentPaths){
|
|||
|
||||
if (volumePathLength == 1) { if (debug) std::cout << "Skill Issue" << std::endl; continue; }
|
||||
if (debug) std::cout << volumeName;
|
||||
if (debug) {
|
||||
//pathSchecker
|
||||
// if (debug && volumePaths[0] == 'E') {
|
||||
// std::cout << volumePathLength << std::endl;
|
||||
// /*exit(1);*/
|
||||
// for (int i = 0; i < volumePathsBufferSize; i++){
|
||||
// std::cout << std::to_string(i) + ": ";
|
||||
// std::cout << volumePaths[i];
|
||||
// std::cout << " | ";
|
||||
// }
|
||||
// std::cout << std::endl << "I IA" << std::endl;
|
||||
// exit(1);
|
||||
|
||||
//pathSchecker
|
||||
// if (debug && volumePaths[0] == 'E') {
|
||||
// std::cout << volumePathLength << std::endl;
|
||||
// /*exit(1);*/
|
||||
// for (int i = 0; i < volumePathsBufferSize; i++){
|
||||
// std::cout << std::to_string(i) + ": ";
|
||||
// std::cout << volumePaths[i];
|
||||
// std::cout << " | ";
|
||||
// }
|
||||
if(numVolumes += explodePaths(volumePaths, volumePathsBufferSize, separator, onPresentPaths)){
|
||||
for (int i = 0; i < onPresentPaths->size(); i++){
|
||||
std::cout << onPresentPaths->at(i) << std::endl;
|
||||
}
|
||||
|
||||
// std::cout << std::endl << "I IA" << std::endl;
|
||||
// exit(1);
|
||||
// }
|
||||
if(numVolumes += explodePaths(volumePaths, volumePathsBufferSize, separator, onPresentPaths)){
|
||||
for (int i = 0; i < onPresentPaths->size(); i++){
|
||||
std::cout << onPresentPaths->at(i) << std::endl;
|
||||
}
|
||||
//std::cout << volumePaths << std::endl;
|
||||
}
|
||||
//std::cout << volumePaths << std::endl;
|
||||
|
||||
if (debug) std::cout << std::to_string(volumePathLength) + " " ;
|
||||
if (debug) std::cout << "THE END" << std::endl;
|
||||
|
||||
|
|
@ -205,8 +222,7 @@ int listVolumes(std::vector<char*> *onPresentPaths){
|
|||
if (debug) std::cout << "no volumes found wtf" << std::endl;
|
||||
}
|
||||
|
||||
//TODO necesario? di CAMBIAR 4 A NUL
|
||||
std::fill(volumePaths, volumePaths + volumePathsBufferSize, '4');
|
||||
std::fill(volumePaths, volumePaths + volumePathsBufferSize, '\0');
|
||||
} while (FindNextVolume(hFind, volumeName, volumeNameSize) != 0);
|
||||
|
||||
if (debug) std::cout << std::to_string(onPresentPaths->size()) + " JUST BEFORE MAIN" << std::endl;
|
||||
|
|
@ -341,12 +357,11 @@ int main(int, char**)
|
|||
static int numVolumes;
|
||||
static std::vector<char*> onPresentPaths;
|
||||
|
||||
if (debug && isListVolumesAdequate) {
|
||||
if (isListVolumesAdequate) {
|
||||
isListVolumesAdequate = false;
|
||||
//std::cout << isListVolumesAdequate << std::endl;
|
||||
numVolumes = listVolumes(&onPresentPaths);
|
||||
if (debug) std::cout << std::to_string(numVolumes) + "<- depth MAIN size() ->" + std::to_string(onPresentPaths.size()) << std::endl;
|
||||
//TODO tiyuria
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -356,6 +371,7 @@ int main(int, char**)
|
|||
static char* currentPathPtr = ¤tPath[0];
|
||||
|
||||
static int currentItemIdx = -1;
|
||||
//TODO David momento
|
||||
static std::vector<char*> displayContents;
|
||||
std::vector<char*> directoryContents;
|
||||
static int numFiles = 0;
|
||||
|
|
@ -363,7 +379,7 @@ int main(int, char**)
|
|||
if (debug) ImGui::Text("%s primir", currentPath);
|
||||
|
||||
if(isListDirectoriesAdequate) {
|
||||
if (debug) std::cout << "renderiso" << std::endl;
|
||||
log_debugcpp("renderiso");
|
||||
isListDirectoriesAdequate = false;
|
||||
if(!retrieveCurrentDirectory(¤tPathPtr)) {
|
||||
if (debug) std::cout << "pencaste";
|
||||
|
|
@ -371,14 +387,22 @@ int main(int, char**)
|
|||
}
|
||||
//
|
||||
//TODO ELIMINAR RESTRICCION EXE; PRUEBITA DEL SIGNIORE
|
||||
static std::vector<std::string> restrictToExe = { "exe" };
|
||||
static std::vector<std::string> restrictToExe{"exe", "DSDFD"};
|
||||
numFiles = (listDirectory(std::string(currentPath), &directoryContents));//, &restrictToExe));
|
||||
//std::cout << numFiles;
|
||||
if (numFiles < 0) {
|
||||
ImGui::Text("Path not valid");
|
||||
if (debug) std::cout << "pencaste 2 el repencazo";
|
||||
goto filepickerFailure;
|
||||
}
|
||||
if (numFiles == 0) {
|
||||
if (debug) std::cout << std::to_string (numFiles) << "<- NUM FILES" << std::endl;
|
||||
char empty[] = "Empty";
|
||||
numFiles++;
|
||||
directoryContents.push_back(empty);
|
||||
}
|
||||
displayContents = std::move(directoryContents);
|
||||
directoryContents.clear();
|
||||
}
|
||||
|
||||
//It's renderin' time
|
||||
|
|
@ -392,7 +416,6 @@ int main(int, char**)
|
|||
for (int i = 0; i < onPresentPaths.size(); i++) {
|
||||
if (i > 0) ImGui::SameLine();
|
||||
// if (debug) std::cout << std::to_string(i) + "<- WE IN" << std::endl;
|
||||
//TODO dabid aiuda
|
||||
// ImGui::PushID(i);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));
|
||||
|
|
@ -405,10 +428,11 @@ int main(int, char**)
|
|||
// ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Permanentes e increiblemente utilitarios botones en Cuatro K
|
||||
//c pervirtio con unicode std::wstring s(L"←→↑↓");
|
||||
//TODO TREMENDA MANDING DICK
|
||||
static char moveUp[2] = {'.', '.'};
|
||||
static char moveUp[] = "..";
|
||||
static char* moveUpPtr = &moveUp[0];
|
||||
if(ImGui::Button("Move Up")){
|
||||
moveDirectory(&moveUpPtr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue