fix: wrong PadState used
This commit is contained in:
parent
9b6fc22826
commit
0a9e0daa17
@ -34,6 +34,7 @@ int main(int argc, char *argv[])
|
||||
socketInitializeDefault();
|
||||
|
||||
printf(CONSOLE_BLUE "Switch Nexcloud\n\nPress A to start.\n" CONSOLE_RESET);
|
||||
consoleUpdate(NULL);
|
||||
while (appletMainLoop())
|
||||
{
|
||||
padUpdate(&pad);
|
||||
@ -42,7 +43,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
break;
|
||||
}
|
||||
consoleUpdate(NULL);
|
||||
}
|
||||
|
||||
INIReader reader("/switch/NXDavSync.ini");
|
||||
@ -81,6 +81,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
c->set_basic_auth(username, password);
|
||||
}
|
||||
c->set_pad_state(&pad);
|
||||
clients.push_back(make_pair(buf, c));
|
||||
}
|
||||
}
|
||||
@ -133,7 +134,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
break;
|
||||
}
|
||||
consoleUpdate(NULL);
|
||||
}
|
||||
|
||||
socketExit();
|
||||
|
@ -48,6 +48,11 @@ void WebDavClient::set_basic_auth(std::string username, std::string password)
|
||||
this->reset();
|
||||
}
|
||||
|
||||
void WebDavClient::set_pad_state(PadState *pad)
|
||||
{
|
||||
this->pad = pad;
|
||||
}
|
||||
|
||||
string formulate_actual_url(string &root, string &rel_path)
|
||||
{
|
||||
if (!rel_path.empty())
|
||||
@ -448,13 +453,12 @@ vector<pair<string, bool>> recursively_get_dir(string base_path, string ext_path
|
||||
return paths;
|
||||
}
|
||||
|
||||
bool user_confirm()
|
||||
bool WebDavClient::user_confirm()
|
||||
{
|
||||
PadState pad;
|
||||
while (appletMainLoop())
|
||||
{
|
||||
padUpdate(&pad);
|
||||
u32 kDown = padGetButtonsDown(&pad);
|
||||
padUpdate(this->pad);
|
||||
u32 kDown = padGetButtonsDown(this->pad);
|
||||
if (kDown & HidNpadButton_A)
|
||||
{
|
||||
return true;
|
||||
@ -521,7 +525,7 @@ bool WebDavClient::compareAndUpdate()
|
||||
printf(CONSOLE_YELLOW "Local version newer on above file.\n" CONSOLE_RESET);
|
||||
printf(CONSOLE_YELLOW "Upload (A) or Not (B)?\n" CONSOLE_RESET);
|
||||
consoleUpdate(NULL);
|
||||
if (user_confirm())
|
||||
if (this->user_confirm())
|
||||
{
|
||||
// Upload local version
|
||||
printf("%s: local modified, uploading...\n\n", path.c_str());
|
||||
@ -543,7 +547,7 @@ bool WebDavClient::compareAndUpdate()
|
||||
printf(CONSOLE_YELLOW "Download (A) or Not (B)?\n" CONSOLE_RESET);
|
||||
consoleUpdate(NULL);
|
||||
// Pull remote version
|
||||
if (user_confirm())
|
||||
if (this->user_confirm())
|
||||
{
|
||||
printf("%s: remote modified, downloading...\n\n", remote_file.path.c_str());
|
||||
consoleUpdate(NULL);
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
~WebDavClient();
|
||||
/// Configure this instance to use HTTP simple auth
|
||||
void set_basic_auth(std::string username, std::string password);
|
||||
/// Configure the pad state for user confirmation
|
||||
void set_pad_state(PadState *pad);
|
||||
/// Make a directory on the remote server
|
||||
bool mkcol(std::string web_path_rel, std::optional<u64> mtime);
|
||||
/// Push a file to the remote WebDAV collection
|
||||
@ -38,10 +40,12 @@ public:
|
||||
|
||||
private:
|
||||
CURL *curl;
|
||||
PadState *pad;
|
||||
std::string web_root; // Base URL
|
||||
std::string local_root;
|
||||
bool use_basic_auth;
|
||||
std::string username;
|
||||
std::string password;
|
||||
void reset();
|
||||
bool user_confirm();
|
||||
};
|
Loading…
Reference in New Issue
Block a user