Skip to content

Commit 9ea4522

Browse files
committedMay 11, 2015
Fix #1325
1 parent a573ed9 commit 9ea4522

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed
 

Diff for: ‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Features
1111
Bugfixes
1212
--------
1313

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

Diff for: ‎nikola/__main__.py

+3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def main(args=None):
9090
quiet = True
9191
global config
9292

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

149152
site = Nikola(**config)
150153
DN = DoitNikola(site, quiet)

Diff for: ‎nikola/nikola.py

+1
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ def __init__(self, **config):
285285
self.colorful = config.pop('__colorful__', False)
286286
self.invariant = config.pop('__invariant__', False)
287287
self.quiet = config.pop('__quiet__', False)
288+
self.original_cwd = config.pop('__cwd__', False)
288289
self.configuration_filename = config.pop('__configuration_filename__', False)
289290
self.configured = bool(config)
290291
self.injected_deps = defaultdict(list)

Diff for: ‎nikola/plugins/command/new_post.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def _execute(self, options, args):
345345
if not path:
346346
txt_path = os.path.join(output_path, slug + suffix)
347347
else:
348-
txt_path = path
348+
txt_path = os.path.join(self.site.original_cwd, path)
349349

350350
if (not onefile and os.path.isfile(meta_path)) or \
351351
os.path.isfile(txt_path):

0 commit comments

Comments
 (0)
Please sign in to comment.