-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add get_remapped_files() method to Directory #59334
Add get_remapped_files() method to Directory #59334
Conversation
d790037
to
2e743e2
Compare
I would approach this a bit different. Since the exporter knows everything that is removed and remapped, the exporter could keep track of all this and then add a file to the project like
The Godot directories API can then try to open this file and if found, then it will simply remap them. It would be only useful for directories (files does not need except for File::exists). |
You mean e.g. loading |
Check references to |
I will be doing a few changes to the exporter soon because I need to complete the server export target based on the work by @Faless. I can take the chance and implement this as I described as it should not be so complex. |
Ah I think I now understand what you meant in the first comment 😅 (partially at least) I get that I can obtain remaps in a more reliable way, but it can't be used by |
yeah this "simply rename especially as demonstrated by:
being clearly untrue, given also:
yes, potentially every one. that's why hardcoding string replacements will never cut it. you'll need to access the current map somehow.
can you explain that? why can't you just simply ask the see also |
I tried using I'll rebase the PR and make it include all files in the directory, mapping imports to original files and removing duplicates. So it will be the same as
It was true at the time of writing this .-. |
2e743e2
to
123f8d6
Compare
that is kinda expected yeah, the
yeah i think that's probably the best approach, just "unmapping" as much as possible from the export process in the result. that's not what you're doing in 123f8d6 though, still renaming according to a list.
was it? arbitrary asset remapping (e.g. per-language and per-buildprofile) and binary export formats have existed in some form since 2.x iirc? and the former (especially the even worse case: completely arbitrary and nondeterministic per-exportplugin! i can totally see game projects run their own remapper plugins to customize builds/etc) is the reason a "remapping dictionary" like you're building can't ever work reliably, i'm afraid. you'll somehow have to either grab that info from the runtime VFS, or, if not available there, maybe export the metadata as part of the rewriting going on during said export and then read that back in? essentially providing |
So again, when you list files from the editor, you get A proper unmapping requires a new system that would handle these files. I'm not particularly interested in implementing it, as @reduz clearly has some idea and I was waiting for his implementation. |
This would be great to get merged in. In the meantime I'm using a wrapper function that behaves consistently between in-editor and in-exported versions of my project:
alternatively with fewer lines and variables:
|
for the record, @horizoncarlo found it necessary to send me a private email from a non-replyable address, ordering me to tell him "the alternative to DirAccess.get_files_at", to which I will refer to literally this whole thread as to why a) even though clearly he read it because he thumbsdown-reacted multiple correct posts (interestingly exclusively and all of mine, so totally not petty). someone needs to read the CoC. EDIT: and now he's chosen to contact me via the same email directly again, apparently not being able to get any hint. |
Superseded by #96590 |
Resolves #25672
I clarified the description of
get_files()
to mention what happens on export and addedget_remapped_files()
method. The method returns the list of original files based on remaps. The list is consistent between editor and exported project.For example, the original list of files returned by
get_files()
when running from editor:List from
get_remapped_files()
:get_files()
in exported project:^ this is different than in editor (hence infinite confusion for some users)
List from
get_remapped_files()
:^ same as in editor.
get_remapped_files()
handles.import
,.remap
and.gdc
files (the latter is probably not needed anymore, see #59241), but maybe there are more files that differ in export?