Skip to content

Commit

Permalink
moved registry code out of ManipulateLinkDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas O'Connor committed Mar 24, 2016
1 parent cbeba86 commit 9660dd8
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions Tilandis/Tilandis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ int CALLBACK wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR, int nShow) {
}
if (Tilandis::UsingCommandLine(argc, argv)) { // FIXME: Commandline processing, while it works, is extremely friggin weird because I wrote it stoned
try {
bool result = Tilandis::ManipulateLinkDocument();
if (result) { return 0; }
else { return 1; }
if (Tilandis::AddToRegistry) {
bool result = Tilandis::RegisterProtocol();
if (!result) {
MessageBox(NULL, L"Failed to register Tilandis with specified protocol (hint: this function needs administrator rights)", L"Tilandis", MB_ICONERROR);
return 1;
} else {
MessageBox(NULL, L"Tilandis has \"successfully\" registered itself with the specified protocol.\r\nBe aware that though no error is reported, many failure cases aren't currently detected. If it still doesn't work, you'll have to double-check the registry yourself.\n\n(Note: If you have TileCreator Proxy installed, you may have to change the associations in the Default Programs control panel.)",
L"Tilandis", 0);
return 0;
}
} else {
bool result = Tilandis::ManipulateLinkDocument();
if (result) { return 0; }
else { return 1; }
}
}
catch (Tilandis::Exceptions::BadCommandLine exc) {
std::wcout << exc.what() << std::endl;
Expand Down Expand Up @@ -153,15 +165,4 @@ bool Tilandis::ManipulateLinkDocument() {
return false;
}
}
if (Tilandis::AddToRegistry) {
bool result = Tilandis::RegisterProtocol();
if (!result) {
MessageBox(NULL, L"Failed to register Tilandis with specified protocol (hint: this function needs administrator rights)", L"Tilandis", MB_ICONERROR);
return 1;
} else {
MessageBox(NULL, L"Tilandis has \"successfully\" registered itself with the specified protocol.\r\nBe aware that though no error is reported, many failure cases aren't currently detected. If it still doesn't work, you'll have to double-check the registry yourself.\n\n(Note: If you have TileCreator Proxy installed, you may have to change the associations in the Default Programs control panel.)",
L"Tilandis", 0);
return true;
}
}
}

0 comments on commit 9660dd8

Please sign in to comment.