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

Cannot open the file when starting AI downloaded via online service #8230

Closed
SamuXarick opened this issue Jun 19, 2020 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@SamuXarick
Copy link
Contributor

Version of OpenTTD

1.10.2

Expected result

Script starts normaly

Actual result

Script error with: cannot open the file

Steps to reproduce

Download NotPerfectAI from the online service, set it up and start a new game.

Unnamed, 1950-01-09

@James103
Copy link
Contributor

Have you tried manually downloading the package from outside of OpenTTD's internal online content downloader and checking that it works there? This could be related to #6969.

@LordAro
Copy link
Member

LordAro commented Jun 19, 2020

Curious, but seems very unlikely to be (directly) related to #6969

@glx22 glx22 added the bug Something isn't working label Jun 19, 2020
@glx22
Copy link
Contributor

glx22 commented Jun 19, 2020

I'm trying to trace it

@glx22
Copy link
Contributor

glx22 commented Jun 19, 2020

I think it's because

require("../enginemanager.nut");
require("../utils.nut");
require("../investment.nut");
require("../industry.nut");
require("../town.nut");

@LordAro
Copy link
Member

LordAro commented Jun 19, 2020

Can you elaborate?

@glx22
Copy link
Contributor

glx22 commented Jun 19, 2020

The "cannot open the file" error is thrown when trying to open "notperfectai-1.0\transportplan\..\enginemanager.nut" because

TarFileList::iterator it = _tar_filelist[subdir].find(resolved_name);
can't find it in the tar.

@James103
Copy link
Contributor

Is the file actually present in the tar and just not being detected by OpenTTD's code?

@nielsmh
Copy link
Contributor

nielsmh commented Jun 20, 2020

Based on glx's comment I understand the issue to be that OpenTTD is looking for a file named notperfectai-1.0\transportplan\..\enginemanager.nut but the tar contains a file named notperfectai-1.0\enginemanager.nut - i.e. the issue is that OpenTTD is not resolving relative paths by collapsing the subdirectory and up-directory in the path to nothing.
So the solution would be to look for .. path components and have them remove the previous path component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants