Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Commit

Permalink
main: uninstall function.
Browse files Browse the repository at this point in the history
  • Loading branch information
ysc3839 committed Feb 19, 2018
1 parent 8c1b357 commit 44f7492
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ bool install_distor(void)
return false;
}

bool uninstall_distor(void)
{
fputs("Will uninstall AOSC for WSL, continue? [y/N] ", stdout);
char ch = getchar();
if (tolower(ch) == 'y')
{
puts("Removing filesystem...");
HRESULT hr = _WslUnregisterDistribution(DISTOR_NAME);
if (SUCCEEDED(hr))
{
puts("Successfully removed distro.");
return true;
}
else
{
printf("Failed to remove! (%X)\n", hr);
}
}
else
{
puts("Abort.");
}
return false;
}

bool run_wsl(int argc, wchar_t *argv[])
{
size_t command_len = 0;
Expand Down Expand Up @@ -145,6 +170,8 @@ int main(void)
}
else if (wcscmp(command, L"uninstall") == 0 || wcscmp(command, L"clean") == 0)
{
if (!uninstall_distor())
retval = 1;
}
else
{
Expand Down

0 comments on commit 44f7492

Please sign in to comment.