Skip to content

Commit

Permalink
Fix include ordering and update shiptest.dme to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
blinkdog committed Jul 21, 2024
1 parent cbf5b49 commit 7a7f3e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions tools/starfly/python/check_dme_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7a7f3e0

Please sign in to comment.