diff options
author | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-10-04 20:52:42 +0900 |
---|---|---|
committer | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-10-04 20:52:42 +0900 |
commit | 5eb459f5a610dae041a278a1331dfd33e8b37afe (patch) | |
tree | 94fa2e2f4d432a46bd4a57f66a6d18ce39814cfb | |
parent | ecfeece952daa2708473fc28e7cbb71ad4664e88 (diff) | |
download | sphinx-git-5eb459f5a610dae041a278a1331dfd33e8b37afe.tar.gz |
abort sphinx-quickstart when project path is not a empty directory.
-rw-r--r-- | sphinx/quickstart.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index ce808e6d1..184c25cb5 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -1483,6 +1483,15 @@ def main(argv=sys.argv): d['makefile'] = False if 'no_batchfile' in d: d['batchfile'] = False + + if path.exists(d['path']) and ( + not path.isdir(d['path']) or os.listdir(d['path'])): + print() + print(bold('Error: specified path is not a directory, or not a' + ' empty directory.')) + print('sphinx-quickstart only generate into a empty directory.' + ' Please specify a new root path.') + return else: ask_user(d) except (KeyboardInterrupt, EOFError): |