Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache views in the same subdirectory as their template #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Murnto
Copy link

@Murnto Murnto commented Aug 1, 2016

See #5

@s-ludwig
Copy link
Member

s-ludwig commented Aug 1, 2016

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.

@Murnto
Copy link
Author

Murnto commented Aug 1, 2016

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.

@s-ludwig
Copy link
Member

s-ludwig commented Aug 1, 2016

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
Copy link
Member

s-ludwig commented Aug 3, 2016

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.

@schveiguy
Copy link
Contributor

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
Copy link
Contributor

See #72 for an alternate solution to this.

@schveiguy
Copy link
Contributor

This should be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants