Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1712 from getnikola/fix-1325
Fix #1325
  • Loading branch information
ralsina committed May 12, 2015
2 parents e78294e + 9ea4522 commit cb1ede7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -11,6 +11,7 @@ Features
Bugfixes
--------

* new_post paths are now relative to CWD (Issue #1325)
* Handle strange URLs, like ed2k:// (Issue #1695)
* Fix very old metadata format support (Issue #1689)

Expand Down
3 changes: 3 additions & 0 deletions nikola/__main__.py
Expand Up @@ -90,6 +90,8 @@ def main(args=None):
quiet = True
global config

original_cwd = os.getcwd()

# Those commands do not require a `conf.py`. (Issue #1132)
# Moreover, actually having one somewhere in the tree can be bad, putting
# the output of that command (the new site) in an unknown directory that is
Expand Down Expand Up @@ -145,6 +147,7 @@ def main(args=None):
config['__invariant__'] = invariant
config['__quiet__'] = quiet
config['__configuration_filename__'] = conf_filename
config['__cwd__'] = original_cwd

site = Nikola(**config)
DN = DoitNikola(site, quiet)
Expand Down
1 change: 1 addition & 0 deletions nikola/nikola.py
Expand Up @@ -285,6 +285,7 @@ def __init__(self, **config):
self.colorful = config.pop('__colorful__', False)
self.invariant = config.pop('__invariant__', False)
self.quiet = config.pop('__quiet__', False)
self.original_cwd = config.pop('__cwd__', False)
self.configuration_filename = config.pop('__configuration_filename__', False)
self.configured = bool(config)
self.injected_deps = defaultdict(list)
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/new_post.py
Expand Up @@ -345,7 +345,7 @@ def _execute(self, options, args):
if not path:
txt_path = os.path.join(output_path, slug + suffix)
else:
txt_path = path
txt_path = os.path.join(self.site.original_cwd, path)

if (not onefile and os.path.isfile(meta_path)) or \
os.path.isfile(txt_path):
Expand Down

0 comments on commit cb1ede7

Please sign in to comment.