Wednesday, September 26, 2007

xselect and directory paths with spaces

Eric Miller points out that xselect runs into problems on the Mac if the directory path has a space in it even if a soft link is used to produce a path without a space. This occurs because xselect calls getcwd to return the current working directory and getcwd resolves any links to give the absolute path. This then runs into the customary problems with directory paths containing spaces.

The best workaround seems to be to change xsel_utils.f and replace

call XPICWD(wrkdir)

with

wrkdir = "./"
call XSL_EXPAND_DIR(wrkdir,status)

since the xsl_expand_dir routine in xsel_unix_c.c spawns a shell and runs pwd to get the current directory path. This method does preserve links.

Note that having an explicit directory path with a space (ie no links) fails in all sorts of ways and will be very hard to work around.

No comments: