Skip to content

Commit

Permalink
Fix handling of --file parameter, as it did not work as advertised.
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Apr 9, 2019
1 parent 33329d4 commit 3185b56
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change log
==========

1.2.1
-----

* 💊 Fix handling of `--file` parameter, as it did not work as advertised.
* 💊 Improve error handling
* 💊 Fix handling of non-valid JSON API replies.

Expand Down
13 changes: 9 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
![](./favicon-64x64.png) Configuration of the <i>Aerofly Wettergerät</i>
=======================================================================

For more information about command line options, call this tool with `--help` appended with the command-line variant of this tool.
For more information about command line options, call the command line variant of this tool with `--help` appended to it.

There is also a [source code documentation on command-line parameters](https://github.com/fboes/aerofly-wettergeraet/blob/master/src/WettergeraetLib/Argumentor.cpp#L20) applicable for the command-line as well as the desktop variant of this tool.

To append parameters to the desktop application, right-click your desktop icon, select "Properties" and append the parameter(s) to the shortcut's target.

![](modify-shortcut.png)

HTTP services
-------------

This tool has been tested with multiple METAR services. To change the METAR service for the command line variant `aerofly-wettergeraet.exe`:
This tool has been tested with multiple METAR services. To change the METAR service for the command line variant `aerofly-wettergeraet.exe` append additional parameters:

```batch
: Supply METAR manually
Expand All @@ -19,7 +25,7 @@ aerofly-wettergeraet.exe --url "http://avwx.rest/api/metar/XXXX?options=&format=
aerofly-wettergeraet.exe --url "https://api.checkwx.com/metar/XXXX/decoded" --apikey "INSERT API KEY HERE"
```

To change the METAR service for the command line variant `aerofly-wettergeraet-desktop.exe` change the target of your desktop shortcut like this:
To change the METAR service for the desktop variant `aerofly-wettergeraet-desktop.exe` change the target of your desktop shortcut:

```batch
: AVWX - this is the default HTTP service
Expand All @@ -28,7 +34,6 @@ aerofly-wettergeraet-desktop.exe --url "http://avwx.rest/api/metar/XXXX?options=
: CheckWX - you will need to get an API key
aerofly-wettergeraet-desktop.exe --url "https://api.checkwx.com/metar/XXXX/decoded" --apikey "INSERT API KEY HERE"
```

Change default values
---------------------

Expand Down
18 changes: 15 additions & 3 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
![](./favicon-64x64.png) Frequently Asked Questions
======================================

Why does the application crash on startup?
Why does the application crash on start-up?
------------------------------------------

Make sure to check these settings:

* A `main.mcf` has to be located at `%USERPROFILE%\Documents\Aerofly FS2\main.mcf`. If this is not the case point the tool to the file location by setting the `--file <FILE>` parameter.
* An internet connection to the [AVWX REST API](http://avwx.rest/) is required. If there is an internet connection but AVWX is not reachable, start the tool with the `--url <URL>` parameter set to a different METAR REST API.
* A `main.mcf` has to be located at `%USERPROFILE%\Documents\Aerofly FS2\main.mcf`. If this is not the case point the tool to the file location by setting the `--file <FILE>` parameter, e.g. `aerofly-wettergeraet-desktop.exe --file "C:\…\main.mcf"`.
* An internet connection to the [AVWX REST API](http://avwx.rest/) is required. If there is an internet connection but AVWX is not reachable, start the tool with the `--url <URL>` parameter set to a different METAR REST API, e.g. `aerofly-wettergeraet-desktop.exe --url "https://www.example.com/"`.

See [the <i>Wettergerät</i>'s configuration guide](configuration.md) on how to set parameters.

If these conditions are met but you are still experiencing crashes, please submit an [issue description](https://github.com/fboes/aerofly-wettergeraet/issues), we'll look into it.


What does "Wettergerät" even mean?
----------------------------------

Actually it is German. It means "weather device" and for German ears has a funny touch to it, as no one would call a thermometer or barometer a "Wettergerät".

"Wetter" is pronounced `\[ˈvɛtɐ ɡəˈʁɛːt\]`. Well, somewhat like "vetter" - "gay" - "rat", but without the "y" in "gay" and a long "a" in "rat".

Fun fact: a written German umlaut "ä" can be replaced with an "ae" - the two small dots above the "a" [are leftovers of an "e" placed above an "a"](https://en.wikipedia.org/wiki/Diaeresis_(diacritic)#Umlaut).

---

Return to [table of contents](README.md).
Binary file added docs/modify-shortcut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions src/WettergeraetLib/Argumentor.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "stdafx.h"
#include "Argumentor.h"

const char* Argumentor::APP_VERSION = "1.2.0";
const char* Argumentor::APP_VERSION = "1.2.1";
#if _WIN64
const char* Argumentor::APP_TARGET = "64bit";
const char* Argumentor::APP_TARGET = "64-bit";
#else
const char* Argumentor::APP_TARGET = "32bit";
const char* Argumentor::APP_TARGET = "32-bit";
#endif

char * Argumentor::getEnv(const char * varName)
Expand All @@ -26,6 +26,7 @@ std::string Argumentor::showHelp(std::string cmd)
+ " [FILE] File to modify. Defaults to 'main.mcf' in standard\n"
+ " Aerofly document path.\n"
+ "Options:\n"
+ " --file <FILE> Like `[FILE]`, see above.\n"
+ " --url <URL> Fetch response via HTTP from <URL>.\n"
+ " If URL contains 'XXXX' this will be replaced by <ICAO>.\n"
+ " Defaults to URL of AvWX.\n"
Expand Down Expand Up @@ -111,7 +112,10 @@ void Argumentor::getArgs(int argc, char * argv[])
this->verbosity = 2;
}
else if (i + 1 < argc) {
if (currentArg == "--url") {
if (currentArg == "--file") {
strcpy_s(this->filename, 512, argv[i]);
}
else if (currentArg == "--url") {
strcpy_s(this->url, 512, argv[++i]);
}
else if (currentArg == "--icao") {
Expand Down

0 comments on commit 3185b56

Please sign in to comment.