mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 17:26:22 +01:00
fix(launcher): the scans of the sceneries and the vehicles go past folders they can't read, a vehicle dropped without its skin set isn't added
A folder without the permission to read it or a name that can't be converted ended the scan with an exception. Ctrl+Delete with no trainset selected, a dropped skin whose vehicle is gone, and a description with a % in it no longer crash the launcher.
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
|
||||
void ui::vehicles_bank::scan_textures()
|
||||
{
|
||||
for (auto &f : std::filesystem::recursive_directory_iterator("dynamic")) {
|
||||
if (f.path().filename() != "textures.txt")
|
||||
std::error_code error;
|
||||
for (std::filesystem::recursive_directory_iterator f{"dynamic", std::filesystem::directory_options::skip_permission_denied, error}, end; f != end; f.increment(error)) {
|
||||
if (f->path().filename() != "textures.txt")
|
||||
continue;
|
||||
|
||||
std::fstream stream(f.path(), std::ios_base::binary | std::ios_base::in);
|
||||
ctx_path = std::filesystem::relative(f.path().parent_path(), "dynamic/");
|
||||
std::fstream stream(f->path(), std::ios_base::binary | std::ios_base::in);
|
||||
ctx_path = std::filesystem::relative(f->path().parent_path(), "dynamic/", error);
|
||||
|
||||
std::string line;
|
||||
while (std::getline(stream, line))
|
||||
|
||||
Reference in New Issue
Block a user