Number: 503
Title: VRML generates .png files in wrong folder
Submitter: Oleg Kobchenko
Date: Thu Aug 5 09:12:15 2004
Subsys: Output generation
Version: 1.10.20040120.0515
System: x86-Windows-XP
Severity: critical
Problem:
VRML generator puts .png files in "current folder" instead of the same folder as the -ofile. As a result,

- the output .vrml file is unusable, because the location of .png in it is specified in the same folder as the .vrml file, but .png files reside elsewhere

- there is no control over location of the output .png files using comand-line/graph attributes (it's undesirable to switch current folder from the calling application)

Steps to reproduce:

1. Consider such folder structure: .../graphviz // location of executables .../graphviz/test // location of input file and "current folder" .../graphviz/test/out // location of output files

2. In terminal session cd to graphviz/test: c:/> cd graphviz/test c:/graphviz/test> _

3. Run dot specifying out as the output folder

c:/graphviz/test> ../dot -Tvrml -oout/test.vrml test.dot

4. Result: the test.vrml is in out folder and all .png files are in the test folder. Expected: .png files in out folder, same as .vrml file.

Any valid dot file works as input.
Comments:
Function "gdirname" in vrmlgen.c may not parse the path correctly, because in uses a hardcoded Unix-style separator '/'. It is expected that the separator be dependent on the platform, for Windows it is '\' (single back slash).
Fix:


/* vrmlgen.c
 * it uses Output_file_name, but it's apparently never assigned
 * a value, which is used in job->output_filename, set in
 * gvrender_output_filename_job (gvrender.c) from input.c
 */

static char *nodefilename(node_t *n, char *buf) { static char *dir; static char disposable[1024]; char junkbuf[1024];

if (dir == 0) { if (Output_file_name) dir = gdirname(strcpy(disposable,Output_file_name)); else dir = "."; } sprintf(buf,"%s/%s", dir, nodeURL(n,junkbuf)); return buf; }


Owner: *
Status: *