From 3e39a0b56d4e263b2f2e3e2fe6110560546e853f Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Thu, 13 Apr 2017 16:58:30 -0400 Subject: [PATCH] list comprehension and prefer HOME changes were suggested by kwolekr on github.com/expertmm/minetest/utils pull request (prefer HOME since he says HOME may exist on Windows under certain configurations) --- minetestmapper-expertmm.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/minetestmapper-expertmm.py b/minetestmapper-expertmm.py index 7a27af3..84b00fc 100644 --- a/minetestmapper-expertmm.py +++ b/minetestmapper-expertmm.py @@ -224,9 +224,7 @@ if geometry_string is not None: coords_string, width_string, height_string = parts coords = coords_string.split(":") if len(coords) == 2: - x_string, z_string = coords - x = int(x_string) - z = int(z_string) + x, z = [int(coord) for coord in coords] this_width = int(width_string) this_height = int(height_string) nonchunky_xmin = x @@ -293,10 +291,10 @@ colors = {} colors_path = "colors.txt" profile_path = None -if 'USERPROFILE' in os.environ: - profile_path = os.environ['USERPROFILE'] -elif 'HOME' in os.environ: +if 'HOME' in os.environ: profile_path = os.environ['HOME'] +elif 'USERPROFILE' in os.environ: + profile_path = os.environ['USERPROFILE'] mt_path = None mt_util_path = None