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

Spaces in -fs_userpath are not allowed #122

Closed
DeathByDenim opened this issue Jul 29, 2022 · 3 comments · Fixed by #125
Closed

Spaces in -fs_userpath are not allowed #122

DeathByDenim opened this issue Jul 29, 2022 · 3 comments · Fixed by #125

Comments

@DeathByDenim
Copy link
Contributor

When trying to set -fs_userpath to a path with spaces, only the part before the space is being considered. For example, when running opensoldat like this:

./bin/opensoldat -fs_portable 0 -fs_userpath ~/temp/soldat\ with\ space -join 127.0.0.1 23073

The reason is that at some point in shared/Command.pas there is code like this;

  InputParse := TStringList.Create;
  InputParse.Delimiter := ' ';
  InputParse.DelimitedText := TrimLeft(Input);

So even though the argument is correctly supplied on the command line, the above code will just split it out anyway.

I'll open a PR for this one. I was able to solve this one locally (although it's affected by issue #121).

@BranDougherty
Copy link
Member

It's actually possible to do this already, quoted strings are supported out of the box by TStringList. You can see it in action in the default server.cfg, where sv_hostname is set to "My Server" (with the space included). Using this from the command line will probably be ugly, because the quote needs to actually reach OpenSoldat and shells like to mess with quotes. The following worked ok for me with bash and fish:

./opensoldatserver -fs_userpath "\"~/temp/soldat with space\"" -log_level 1

But of course this is a pretty bad documentation problem, which should be solved ASAP. Anyone is welcome to take a stab at adding a few pages to the wiki, and I'll try to get around to adding some documentation myself soon.

@DeathByDenim
Copy link
Contributor Author

Oh, I see. I didn't think of trying that!

It's not exactly pretty though. That gave me an idea. The same could be achieved by changing shared/Command.pas:491 from this:

      CurrentCommand := CurrentCommand + ' ' + argv[i];

to this:

      CurrentCommand := CurrentCommand + ' "' + argv[i] + '"';

I just tried that out and it this allows me tu run as:

./bin/opensoldat -fs_portable 0 -fs_userpath ~/temp/soldat\ with\ space -join 127.0.0.1 23073 -log_level 1

Now escaped spaces work as expected and all the other command-line arguments remain functional as well. What do you think of doing it like that? You wouldn't have to rely on people reading documentation.

@BranDougherty
Copy link
Member

Wayyy better thanks.

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

Successfully merging a pull request may close this issue.

2 participants