Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make entity dump filename windows compatible #5145

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

jdrueckert
Copy link
Member

Contains

  • windows doesn't allow colons (':') in filenames
  • so far the filename included the timestamp in format YYYY-MM-DDTHH:MM:SS.MSZ, e.g. 2023-09-28T17:01:31.685172Z-entityDump.json
  • now colons will be replaced by dashes ('-')

How to test

  1. Start any Terasology world on Windows with this branch checked out
  2. Open the in-game console (F1) and execute dumpEntities
  3. Verify that Terasology does not crash and that an entity dump file without colons in its name is created

Outstanding before merging

  • confirming the fix

Fixes #5144

- windows doesn't allow colons (':') in filenames
- so far the filename included the timestamp in format YYYY-MM-DDTHH:MM:SS.MSZ, e.g. 2023-09-28T17:01:31.685172Z-entityDump.json
- now colons will be replaced by dashes ('-')
@jdrueckert jdrueckert added Type: Bug Issues reporting and PRs fixing problems Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Status: Needs Testing Requires to be tested in-game for reproducibility Size: S Small effort likely only affecting a single area and requiring little to no research Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. labels Sep 28, 2023
@jdrueckert jdrueckert self-assigned this Sep 28, 2023
@jdrueckert jdrueckert added this to the 2023 Revive - Milestone 2 milestone Sep 28, 2023
@@ -479,7 +479,7 @@ public String dumpEntities(@CommandParam(value = "componentNames", required = fa
PrefabSerializer prefabSerializer =
new PrefabSerializer(engineEntityManager.getComponentLibrary(), engineEntityManager.getTypeSerializerLibrary());
WorldDumper worldDumper = new WorldDumper(engineEntityManager, prefabSerializer);
Path outFile = PathManager.getInstance().getHomePath().resolve(Instant.now() + "-entityDump.json");
Path outFile = PathManager.getInstance().getHomePath().resolve(Instant.now().toString().replaceAll(":", "-") + "-entityDump.json");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it not be cleaner to use the iso-8601 basic format in general, and not the extended format? see:
https://stackoverflow.com/questions/27725408/alternative-to-colon-in-a-time-format

Copy link
Contributor

@BenjaminAmos BenjaminAmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that using the dumpEntities commmand does not crash on Windows when testing this pull request.

Windows sometimes makes use of colons in file names for an obscure NTFS feature called file streams. Using that feature usually isn't what you'd want, since it makes the data invisible to most normal programs. There are other special filenames that you should't use but those are just obscure edge-cases that we're unlikely to run into.

@jdrueckert jdrueckert merged commit 254db60 into develop Oct 18, 2023
8 checks passed
@jdrueckert jdrueckert deleted the fix/windows-compatible-entity-dump-filename branch October 18, 2023 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. Size: S Small effort likely only affecting a single area and requiring little to no research Status: Needs Testing Requires to be tested in-game for reproducibility Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems
Projects
Status: Done
Status: Done
Status: No status
Development

Successfully merging this pull request may close these issues.

Entity Dump broken on Windows
3 participants