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

Make the tagger archive path os independent #244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion hyde/ext/plugins/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from itertools import ifilter
from operator import attrgetter
import re
import os
import sys

from hyde.exceptions import HydeException
Expand Down Expand Up @@ -376,7 +377,8 @@ def _create_tag_archive(self, config):
raise HydeException("No Template specified in tagger configuration.")
content = self.site.content.source_folder
source = Folder(config.get('source', ''))
target = content.child_folder(config.get('target', 'tags'))
target_prop = os.path.join(*re.split('[\\/]', config.get('target', 'tags')))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be carefull here! You are splitting with re's both \ and / but joining with os.path.

It also would be nice that such platform dependency should be hidden inside "child_folder" or config.get() (get_path()?). Either way, you should do that for every path you get from config or you pass it to a child_folder.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you are probably right about the child_folder note - although you have to watch that links stay the web way, and only Windows FS paths go the Windows way.

Hmm - the split/join operation needs to be translating one OS separator to the other.

I am not sure about the legality of forward slashes in unix file names or backslashes in windows file names. I may be in danger here of assuming that they are not legal in them - and besides - if shared via source control, dropbox or some other means between them - it would be a problem there too - so this should be a safe assumption.

target = content.child_folder(target_prop)
if not target.exists:
target.make()

Expand Down