diet-ng icon indicating copy to clipboard operation
diet-ng copied to clipboard

Cache views in the same subdirectory as their template

Open Murnto opened this issue 8 years ago • 7 comments

See #5

Murnto avatar Aug 01 '16 08:08 Murnto

How about using something like .replace('/', '_'), so that deeper nestings also work?

BTW, do nested string imports directories work on Windows for the latest DMD versions? They used to work only on other systems, but there was an effort to remove that restriction recently.

s-ludwig avatar Aug 01 '16 09:08 s-ludwig

If cached views are going to be decoupled from their templates, why not place them in a special directory like /views/_cached_/ to avoid polluting /views/?

BTW, do nested string imports directories work on Windows for the latest DMD versions?

I don't run windows to be able to tell you.

Murnto avatar Aug 01 '16 09:08 Murnto

why not place them in a special directory like /views/cached/ to avoid polluting /views/?

Basically just because of the Windows path issue. I'll have to try this out in the evening when I get access to a Windows machine.

s-ludwig avatar Aug 01 '16 09:08 s-ludwig

Okay, finally got the chance to test and it still doesn't work on Windows. So for now, the _cached_ prefix needs to stay. But hopefully all of this will soon be obsoleted with the new CTFE engine.

s-ludwig avatar Aug 03 '16 07:08 s-ludwig

This still is a problem, and prevents using cached templates along with organizing your views into subdirectories.

A simple fix I thought of is to apply only a suffix to the filename instead of a prefix. So e.g.:

enum _diet_cache_file_name = filename~"_cached_"~_diet_hash.to!string~".d"

This would be immune to issues with paths in the filename. It's also a lot simpler than the building of a path. Make sense?

schveiguy avatar Oct 11 '19 12:10 schveiguy

See #72 for an alternate solution to this.

schveiguy avatar Oct 11 '19 16:10 schveiguy

This should be closed now.

schveiguy avatar Oct 11 '19 18:10 schveiguy