Opened 10 years ago

Closed 9 years ago

# Option to create specified cache_dir if it does not exist

Reported by: Owned by: TracContact@… Christian Boos normal GraphvizPlugin normal 0.11

### Description

I think it would be nice if the macro code tried to created the cache_dir specified in trac.ini if it does not exists. To this end, I hacked on graphviz.py from http://trac-hacks.org/svn/graphvizplugin/0.9/ to add this feature. It is enabled by adding

create_cache_dir_if_needed = true

to the trac.ini file.

Attached is my version of graphviz.py and the diff file. I realize that what I did is rough and I'm sure does not follow many standards, so I submit it as a starting point for those who know more about this. However, it does work!

### Changed 10 years ago by TracContact@…

Hacked version that will create specified cache_dir if it does not exist when create_cache_dir_if_needed = true is found in trac.ini file

### Changed 10 years ago by TracContact@…

Diff between my version of graphviz.py and that found in http://trac-hacks.org/svn/graphvizplugin/0.9/

### comment:1 Changed 9 years ago by Christian Boos

Trac Release: 0.10 → 0.11

Well, for me this little issue doesn't seem worth the trouble of an extra option.

When you install that plugin for the first time, chances are that you also will test it right away, then you'll notice that the cache directory must exist. Improving both the cache_dir documentation and the error message to mention this seems to be enough to me.

What would be more useful on this topic is to allow specifying a relative path for the cache_dir (path will be relative to the Trac environment), like we do now for most other stuff in Trac (like the repository_dir), the idea being that you could just move your self-contained Trac environment around. Patches follow.

### Changed 9 years ago by Christian Boos

document the need for creating the cache_dir before hand

### Changed 9 years ago by Christian Boos

[graphviz] cache_dir can be relative to the Trac environment path (must be applied after the previous patch)

### comment:2 Changed 9 years ago by Christian Boos

Owner: changed from Peter Kropf to Christian Boos

There's one more change related to this ticket to come: effectively creating the cache_dir folder when it doesn't exist, but only when that folder is the default relative one, in order to support "plug&play" installations.

### comment:3 Changed 9 years ago by Christian Boos

Resolution: → fixed new → closed

(In [4404]) GraphvizPlugin: in order to help "plug&play" installs, automatically create the cache_dir folder, but only if this corresponds to the default path.

If one sets explicitly a non-default cache_dir, one can as well make sure that this folder exists.

Closes #2157.

### Modify Ticket

Change Properties