Did you know ...?

#10: Spaces in file names

Some GHS users have wondered whether they should stay away from including spaces in file names. The short answer is "no need" - GHS is fully compatible with any legal Windows file path. For example, you can choose any file you want when using the File menu dialogs to "Read geometry file", "Run file", etc., and everything will work smoothly - space or no space in the path.

However, confusion can arise when trying something like the following:

VARIABLE (STRING) FILENAME
SET FILENAME = "ABC DEF"
READ {FILENAME}.GF

...which likely produces a "Path not found" error. But the reason for this error is that the READ command can combine data from multiple geometry files delimited by spaces or commas. As presented in the above example, READ thinks that it should read a file named "ABC" and then combine it with a file named "DEF.GF". So READ is operating correctly according to its advertised syntax.

There is a simple solution whenever a file variable might contain a space - just enclose it in quotes! So the following replacement READ line should work perfectly:

READ "{FILENAME}.GF"

Along these lines, designers of GHS macro libraries need to make a practice of using quotes safely around variables in all file commands such as READ, WRITE, COPY, REN, ERASE, IF FEXIST, etc. The issue here isn't really about support for spaces in file names - it's more about the need to use quotes to be clear to GHS when you're talking about a single parameter (possibly including spaces) and when you're talking about multiple parameters separated by spaces.

As such, quote usage can be pretty important in GHS, so Creative Systems has put some effort into making this as robust and flexible as possible. Using structures such as the SET QUOTE command introduced in version 10 or by doubling internal quote marks, it's even possible to store quotes within quotes, with evaluation of variables containing quote marks handled transparently and logically.

So be aware that GHS and all its helper programs fully support long file names including spaces.

If you need help updating your GHS version, contact support@ghsport.com.

Copyright (C) 2011 Creative Systems, Inc.