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

filesystem.gd returns paths with two forward slashes between directory and file name #63

Closed
Grafcube opened this issue Dec 28, 2019 · 9 comments
Assignees
Labels
bug Something isn't working resolved For features and refactors that got added

Comments

@Grafcube
Copy link
Contributor

Description

When filesystem._list is called, the paths that it returns are like res://path/to//filename.gd. This caused a few problems when I tried to load the templates to copy them.

Possible Fix

In filesystem.gd at line 27 -

var absolute_path: String = "%s/%s" % [path, name]

here, the / between the two %s could be removed, but when I tried that, WAT.tscn kept causing the editor to crash and the error message indicated cyclic reference.
The crashes happened if the addon was enabled, if the scene was opened or if the scene was run (in this case, only the preview window crashed).

@AlexDarigan AlexDarigan self-assigned this Dec 28, 2019
@AlexDarigan AlexDarigan added the bug Something isn't working label Dec 28, 2019
@AlexDarigan
Copy link
Collaborator

Is this causing any issues at the moment or only when you were first trying to do it?

@Grafcube
Copy link
Contributor Author

There aren't any noticeable problems right now. It just causes a hiccup when you try to add/modify anything that uses it. In the case of script templates, I couldn't use i.path and instead had to use script_templates_dir + "/" + i.name.

@AlexDarigan
Copy link
Collaborator

This is odd. It seems to show up with one slash when printing the absolute path from line 27 for me.
Screenshot from 2019-12-28 10-43-07

The extra slash might be coming from somewhere else.

@AlexDarigan
Copy link
Collaborator

(Also to be clear res/user is supposed to be a double slash).

@AlexDarigan
Copy link
Collaborator

The extra slash you added when you were saving the WATTemplate was redundant since the script_templates directory ends with a forward slash.

@AlexDarigan
Copy link
Collaborator

Okay. This is actually weird as hell. It shows differently from the print and the slash.

@AlexDarigan
Copy link
Collaborator

Okay found the issue. You had placed a leading underscore at the wat_templates_dir string. So when you passed that directory to the filesystem.list method, then filesystem was adding an additional slash on top of the one you gave.

@Grafcube
Copy link
Contributor Author

Ah ok. That sort of explains the crash, the scene was looking for a path that didn't exist? I'm not entirely sure.

@AlexDarigan
Copy link
Collaborator

Yeah the crash was the scene trying to look for testdirectorytestscript rather than testdirectory/testscript

@watplugin watplugin locked as resolved and limited conversation to collaborators Dec 28, 2019
@AlexDarigan AlexDarigan added the resolved For features and refactors that got added label Feb 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working resolved For features and refactors that got added
Projects
None yet
Development

No branches or pull requests

2 participants