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

Be stricter on what's considered a scene path in CLI argument parsing #33149

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 29, 2019

Only consider the positional argument to be a scene path if it ends with a file extension associated with Godot scenes. This makes it possible for projects to parse command-line arguments for custom CLI arguments or other file extensions without trouble. This can be used to implement "drag-and-drop onto executable" logic, which can prove helpful for non-game applications.

This closes #8721.

@akien-mga
Copy link
Member

Export now fails on CI:

ERROR: start: Command line param --export passed but no destination path given.

Please specify the binary's file path to export to. Aborting export.

   At: main/main.cpp:1500.

-------------------------------------------------------------------------

ERROR: No PCK file was created while exporting the project.

@lupoDharkael
Copy link
Contributor

I've updated my parser PR based on this: b042d60

@Calinou Could you explain about the "drag-and-drop onto executable" line? I don't know what does that mean or how it is implemented. I may be relevant to my PR.

@Calinou
Copy link
Member Author

Calinou commented Nov 5, 2019

@lupoDharkael What I mean here is that my PR makes drag-and-drop functionality possible (just like file associations, which also become possible). On most desktop OSes, when you drag and drop a file over an executable, it will be started with the absolute path to the file as an argument.

Of course, the application still needs to read command-line arguments, but it will no longer exit as soon as it's started because the scene path isn't valid.

@Chaosus Chaosus added this to the 4.0 milestone Nov 7, 2019
@Calinou Calinou force-pushed the cli-scene-path-parsing-stricter branch from 5732af7 to 9cdce78 Compare January 2, 2020 18:17
@Calinou
Copy link
Member Author

Calinou commented Jan 2, 2020

CLI exporting should be fixed now, if all goes well.

@akien-mga akien-mga modified the milestones: 4.0, 3.2 Jan 10, 2020
@Calinou Calinou force-pushed the cli-scene-path-parsing-stricter branch from 9cdce78 to 0218494 Compare January 10, 2020 12:31
@akien-mga akien-mga merged commit 25c024a into godotengine:master Jan 10, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command line parsing: can't pass custom arguments without leading hash ( -custom )
4 participants