colvars icon indicating copy to clipboard operation
colvars copied to clipboard

Offer some way for parser to deal with spaces in file paths

Open jhenin opened this issue 3 years ago • 2 comments

This is particularly relevant in Windows, where user directories often have spaces in them (maybe OSX as well?). Right now, a path with spaces (say in refPositionsFile) will be detected as several words and trigger an error.

Classic solutions to this are:

  1. escaping spaces
  2. double quotes

To me both options seem fine. Ideally we'd support both. But of course this is still more work for the parser to do.

jhenin avatar Jul 28 '21 07:07 jhenin

Alternatively, using environment variables may be also useful in other scenarios. Something like this:

  refPositionFile  getenv(COMMON_DIR)/coordinates.xyz

which could be confined just to file path values. In principle I'm not against using variables for other values as well, it's just just more difficult to handle at that point.

The main reason why I'm not a big fan of quoting mechanisms specifically for this purpose is that their syntax differs depending on which shell you use (e.g. Bash or PowerShell).

giacomofiorin avatar Mar 29 '22 12:03 giacomofiorin

Proposed solution: make the Dashboard detect spaces in paths it generates, and avoid them by making the paths relative, if possible.

jhenin avatar Feb 09 '24 18:02 jhenin