From f2d166bb4f72bf1afc5206f238f0e9123d8241b9 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Wed, 3 Apr 2019 08:06:18 -0700 Subject: [PATCH] Fix #193: Add place to start 'pre-flight' checks (#214) * Add a module where we can run tests for invariants for the application * Fix 193: Add pre-flight checks * Fix build --- src/editor/bin/Oni2.re | 2 ++ src/editor/bin/PreflightChecks.re | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/editor/bin/PreflightChecks.re diff --git a/src/editor/bin/Oni2.re b/src/editor/bin/Oni2.re index 59a56bce89..a3f5ec2cd8 100644 --- a/src/editor/bin/Oni2.re +++ b/src/editor/bin/Oni2.re @@ -40,6 +40,8 @@ let init = app => { let cliOptions = Core.Cli.parse(setup); Sys.chdir(cliOptions.folder); + PreflightChecks.run(); + let currentState = ref(Model.State.create()); let onStateChanged = v => { diff --git a/src/editor/bin/PreflightChecks.re b/src/editor/bin/PreflightChecks.re new file mode 100644 index 0000000000..c6d11fda23 --- /dev/null +++ b/src/editor/bin/PreflightChecks.re @@ -0,0 +1,17 @@ +/* + * PreflightChecks.re + * + * This establishes and verifies a set of invariants to ensure the environment + * is set up correctly for the application to run. + */ + +open Oni_Core; + +let checkHomeDirectoryOrThrow = () => { + let _ = Filesystem.unsafeFindHome(); + (); +}; + +let run = () => { + checkHomeDirectoryOrThrow(); +};