-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for tmpdir when loading multiple mission files
This change makes sure that each mission file, when loaded, it extracts resources to unique temp dir rather than a shared one, which would lead to resource overwriting when working with multiple loaded missions. I worked with two missions, and each had "briefing.png" attached. When I saved them I noticed that one was overwriting the other. I guess accessing map_resource.files["DEFAULT"].values() directly might not be desired and if you want, I can remove it. I think if m.tmpdir is good, then a validation that m1.tmpdir != m2.tmpdir should be enough. NOTE that get_file_path works only when .miz is loaded. It does not work properly (even before this patch) for missions generated by pydcs, where resources are added, e.g: m = dcs.Mission(terrain=dcs.terrain.Caucasus()) res_key = m.add_picture_blue("tests/images/blue") calling m.map_resource.get_file_path(res_key) would returns "'cs/dcs/tests/images/blue.png'". But that's a separate problem to solve. With this patch the get_file_path() throws an exception, which is IMHO better than silently working wrong. tmpdir is optional since I didn't see the need of creating a new tmp folder every time a new Mission() object is created.
- Loading branch information
1 parent
a9fde5c
commit 2bcc42c
Showing
4 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters