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