From 7a7f3e06c3f07fc3fa252f0958b4ae9ae97b54da Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Sun, 21 Jul 2024 09:28:48 -0500 Subject: [PATCH] Fix include ordering and update shiptest.dme to pass --- shiptest.dme | 4 ++-- tools/starfly/python/check_dme_order.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/shiptest.dme b/shiptest.dme index 5bbf0f165f..a8a4af402a 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -156,7 +156,6 @@ #include "code\__DEFINES\dcs\flags.dm" #include "code\__DEFINES\dcs\helpers.dm" #include "code\__DEFINES\dcs\signals.dm" -#include "code\modules\starfly13\__DEFINES\unathi_colors.dm" #include "code\__HELPERS\_auxtools_api.dm" #include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm" @@ -216,7 +215,6 @@ #include "code\__HELPERS\sorts\InsertSort.dm" #include "code\__HELPERS\sorts\MergeSort.dm" #include "code\__HELPERS\sorts\TimSort.dm" -#include "code\modules\starfly13\__HELPERS\unathi_colors.dm" #include "code\_globalvars\bitfields.dm" #include "code\_globalvars\configuration.dm" #include "code\_globalvars\game_modes.dm" @@ -3328,6 +3326,8 @@ #include "code\modules\spells\spell_types\pointed\blind.dm" #include "code\modules\spells\spell_types\pointed\mind_transfer.dm" #include "code\modules\spells\spell_types\pointed\pointed.dm" +#include "code\modules\starfly13\__DEFINES\unathi_colors.dm" +#include "code\modules\starfly13\__HELPERS\unathi_colors.dm" #include "code\modules\station_goals\bsa.dm" #include "code\modules\station_goals\dna_vault.dm" #include "code\modules\station_goals\shield.dm" diff --git a/tools/starfly/python/check_dme_order.py b/tools/starfly/python/check_dme_order.py index c2f5a4e235..df06fd36b3 100644 --- a/tools/starfly/python/check_dme_order.py +++ b/tools/starfly/python/check_dme_order.py @@ -28,6 +28,10 @@ def get_includes(file_path): return paths def compare_paths(path1, path2): + # compare only with lowercase, because Windows is case-insensitive in paths + path1 = path1.lower() + path2 = path2.lower() + # if the two paths are identical if path1 == path2: # they are identical; no sort preference @@ -60,6 +64,18 @@ def compare_paths(path1, path2): # path2 comes before path1 return 1 + # okay, if they're both files, .dmf files come last + + # if path1 is a .dmf file, and path2 is not a .dmf file + if ('.dmf' in part1) and ('.dmf' not in part2): + # path1 comes after path2 + return 1 + + # if path1 is a not .dmf file, and path2 is a .dmf file + if ('.dmf' not in part1) and ('.dmf' in part2): + # path1 comes before path2 + return -1 + # they are both files, or they are both folders, so we can compare on name # remember, they can't be identical, or they would have been skipped if part1 < part2: