From 7aaa77093b1e3d9d86dec4babf0178a3cd953880 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 27 Mar 2017 12:28:49 -0400 Subject: [PATCH] app.nit: id the platform at runtime MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/android/platform.nit | 2 ++ lib/app/app_base.nit | 7 +++++++ lib/linux/linux.nit | 2 ++ 3 files changed, 11 insertions(+) diff --git a/lib/android/platform.nit b/lib/android/platform.nit index 2f44028..f305144 100644 --- a/lib/android/platform.nit +++ b/lib/android/platform.nit @@ -20,3 +20,5 @@ module platform is platform "android" import java import app import aware + +redef fun bound_platform do return "Android" diff --git a/lib/app/app_base.nit b/lib/app/app_base.nit index b2c26f5..e3e870a 100644 --- a/lib/app/app_base.nit +++ b/lib/app/app_base.nit @@ -115,5 +115,12 @@ end # The running `App` fun app: App do return once new App +# Platform bound at compilation (by importation or -m) +# +# This value should not be used to decide the behavior of the software. +# Class refinement provide a safer and a static solution to apply variations. +# However, this value can be used in log files and communications with servers. +fun bound_platform: String do return "none" + app.setup app.run diff --git a/lib/linux/linux.nit b/lib/linux/linux.nit index e958e2d..32a5ad4 100644 --- a/lib/linux/linux.nit +++ b/lib/linux/linux.nit @@ -60,3 +60,5 @@ redef class TextAsset return content end end + +redef fun bound_platform do return "GNU/Linux" -- 1.7.9.5